We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 977dfb5 commit 1e5d61bCopy full SHA for 1e5d61b
Projects/Caesars-Cipher.js
@@ -0,0 +1,14 @@
1
+function rot13(str) {
2
+ var rotCharArray = [];
3
+ var regEx = /[A-Z]/;
4
+ str = str.split('');
5
+ for (var x in str) {
6
+ if (regEx.test(str[x])) {
7
+ rotCharArray.push(((str[x].charCodeAt() - 65 + 13) % 26) + 65);
8
+ } else {
9
+ rotCharArray.push(str[x].charCodeAt());
10
+ }
11
12
+ str = String.fromCharCode.apply(String, rotCharArray);
13
+ return str;
14
+}
0 commit comments