Created
July 31, 2013 19:39
-
-
Save gerow/6125425 to your computer and use it in GitHub Desktop.
Convert a hex string into a semipronouncable string of characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
string = ARGV[0] | |
puts string.downcase.split("").map{|e| | |
case e | |
when "0" | |
"ka" | |
when "1" | |
"tsu" | |
when "2" | |
"shi" | |
when "3" | |
"ha" | |
when "4" | |
"ko" | |
when "5" | |
"ma" | |
when "6" | |
"ku" | |
when "7" | |
"su" | |
when "8" | |
"so" | |
when "9" | |
"mu" | |
when "a" | |
"mo" | |
when "b" | |
"ya" | |
when "c" | |
"yu" | |
when "d" | |
"ki" | |
when "e" | |
"fu" | |
when "f" | |
"ni" | |
else | |
"INVAL" | |
end | |
}.each_slice(2).to_a.map{|e| e.join}.join(" ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment