Skip to content

Instantly share code, notes, and snippets.

@mlhaufe
Created December 29, 2011 03:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlhaufe/1531747 to your computer and use it in GitHub Desktop.
Save mlhaufe/1531747 to your computer and use it in GitHub Desktop.
JavaScript 1.5 cutesy rot13
function rot13(c){
return c.replace(/([a-m])|([n-z])/ig, function($0,$1,$2){
return $1 ? String.fromCharCode($1.charCodeAt(0) + 13) :
$2 ? String.fromCharCode($2.charCodeAt(0) - 13) : $0; });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment