Hex.fromString
Encodes a string into a Hex.Hex
value.
Imports
Named
import { Hex } from 'ox'
Examples
import { Hex } from 'ox'
Hex.fromString('Hello World!')
// '0x48656c6c6f20576f726c6421'
Hex.fromString('Hello World!', { size: 32 })
// '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000'
Definition
function fromString(
value: string,
options?: fromString.Options,
): Hex
Source: src/core/Hex.ts
Parameters
value
- Type:
string
The string value to encode.
options
- Type:
fromString.Options
- Optional
Options.
options.size
- Type:
number
- Optional
The size (in bytes) of the output hex value.
Return Type
The encoded Hex.Hex
value.
Hex