Is there a built in way to convert an integer in Ruby into its hexadecimal equivalent?
Something like the opposite of String#to_i
:
"0A".to_i(16) #=>10
Like perhaps:
"0A".hex #=>10
I know how to roll my own, but it's probably more efficient to use a built in Ruby function.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…