hex
Hexadecimal encoder and decoder
Import
_ <- fat.extra.hex
Constants
- hexDigits, '0123456789abcdef'
Methods
Name | Signature | Brief |
---|---|---|
toHex | (dec: Number): Text | Encode decimal number to hex |
fromHex | (hex: Text): Number | Decode hex text to number |
maximum value to be encoded / decoded is limited to numeric precision
Usage Notes
Example:
toHex(128) # Text: '80'
fromHex('FFFFFF') # Number: 16777215
toHex
does not implement leading-zero padding, but this can be accomplished with use ofpadLeft
method on util lib