Convert string to integer (hex) : hexadecimal numbers « Number « Ruby






Convert string to integer (hex)


'405'.to_i(16)                  # => 1029
'fed'.hex                       # => 4077
'fed'.to_i(16)                  # => 4077

 








Related examples in the same category

1.Hex number with 0x
2.Convert string to hex