Ad
  • Default User Avatar

    In the defense of this solution - the virtue of ROT13 is that it is its own inverse. That is, if you put the return value back into the same function, you will return the original input.

    This is ONLY possible with a shift of 13 in the english alphabet.

    So there really is no reason to abstract away from 13 and hardcoding the replacement array is actually the most efficient, readbale, and sustainable solution.

    I wouldn't be surprised if most real-world applications of ROT13 do it this way.