I am build an autocomplete that searches off of a CouchDB View.
I need to be able to take the final character of the input string, and replace the last character wit
// This will return A for Z and a for z.
function nextLetter(s){ return s.replace(/([a-zA-Z])[^a-zA-Z]*$/, function(a){ var c= a.charCodeAt(0); switch(c){ case 90: return 'A'; case 122: return 'a'; default: return String.fromCharCode(++c); } }); }