Skip to content

Instantly share code, notes, and snippets.

@kovek
Created January 18, 2013 23:25
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 kovek/4569549 to your computer and use it in GitHub Desktop.
Save kovek/4569549 to your computer and use it in GitHub Desktop.
part1 = 'abcdefghijklm '
part2 = 'nopqrstuvwxyz.'
convert = (text) ->
output = ""
for i in [0...text.length]
index = part1.indexOf text.charAt(i)
if index isnt -1 then output += part2.charAt index else
index = part2.indexOf(text.charAt(i))
output += part1.charAt index
output
console.log convert("hi how are you")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment