Skip to content

Instantly share code, notes, and snippets.

@hyonschu
Created May 29, 2013 00:45
Show Gist options
  • Save hyonschu/5667223 to your computer and use it in GitHub Desktop.
Save hyonschu/5667223 to your computer and use it in GitHub Desktop.
var alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "a", "b", "c"];
var str = "this is a new string of text";
var LetterChanges = function(str) {
var newstr = str.split("");
for (var i=0;i<newstr.length;i++) {
var j=0;
while (newstr[i] != alpha[j] && j<alpha.length) {
j++;
}
newstr[i] = alpha[j+1];
};
for (var j=0;j<newstr.length;j++) {
if (newstr[j] == undefined) {
newstr[j] = " ";
}
else if (newstr[j] == "o") {
newstr[j].toUpperCase();
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment