Simple Sand Samples |
Ruby > 文字列を数値に変換する(文字コードを得る)
str2hex.rb
while line = gets for i in line.split("") printf("%02x\n",i[0]) end end
$ echo -n HELLO | ruby str2hex.rb
48
45
4c
4c
4f
$
48
45
4c
4c
4f
$
* 確認環境 Debian Linux(Wheezy)
Simple Sand Samples |
while line = gets for i in line.split("") printf("%02x\n",i[0]) end end