hexToNumber

Converts a hexadecimal string to a number.

Example

import { hexToNumber } from "thirdweb/utils";
const number = hexToNumber("0x1a4");
console.log(number); // 420
function hexToNumber(
hex: `0x${string}`,
): number;

Parameters

The hexadecimal string to convert.

Type

let hex: `0x${string}`;

Optional options for the conversion.

Type

let opts: { signed?: boolean; size?: number };

Returns

let returnType: number;

The converted number.