This file contains hidden or 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 | |
| #数値を16進数文字列に | |
| p 65.to_s(16) #=> "41" | |
| #数値をASCII文字に | |
| p 65.chr #=> "A" | |
| #文字列を16進数とみなして数値に | |
| p "41".hex #=> 65 |