Generizable Ceaser Cipher

Generizable Ceaser Cipher
0.0 0

#1

I was wondering about a solution to the Ceaser Cipher challenge that would take any range of character or just sequential numbers and shift them any number of positions under the length of the range of the sequence. Like if an alphabet has 80 characters and str.charAtCode() for each character was sequential what kind of solutions would work to shift those characters any distance passed as an argument by the main function.

Using % doesnt seem to work but I am wondering if there is something I don’t grasp about that solution that would make it work?


#2

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.