Skip to main content
Version: Next

Function: getHexString()

getHexString(str): string

Defined in: src/utils/num.ts:267

Convert string to hexadecimal string

Parameters

str

string

string to convert

Returns

string

converted hex-string

Throws

str needs to be a number string in hex or whole number format

Example

const result = getHexString("123");
// result = "0x7b"

const result2 = getHexString("Hello");
// throws Error: Hello needs to be a hex-string or whole-number-string