Created
December 6, 2011 13:31
-
-
Save constantine-nikolaou/1438212 to your computer and use it in GitHub Desktop.
Convert string chars to hex values
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
ree-1.8.7-2011.03 :027 > array = [] | |
=> [] | |
ree-1.8.7-2011.03 :028 > "hello".each_byte {|x| array << x} | |
=> "hello" | |
ree-1.8.7-2011.03 :029 > array.join(",") | |
=> "104,101,108,108,111" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment