Fast byte length for Hex strings.
This function efficiently calculates the byte length of Hex values:
A valid Hex string (with "0x" prefix).
Byte length of the hex string.
bytesLenUnsafe("0x48656c6c6f") // 5bytesLenUnsafe("0x123") // 2 (odd digits round up via padding) Copy
bytesLenUnsafe("0x48656c6c6f") // 5bytesLenUnsafe("0x123") // 2 (odd digits round up via padding)
bytesLen - Validated version for untrusted input
Fast byte length for Hex strings.
This function efficiently calculates the byte length of Hex values: