815 B
815 B
Functions
stringToU8a
▸ stringToU8a(value?: undefined | string): Uint8Array
Defined in string/toU8a.ts:40
name: stringToU8a
signature: stringToU8a (value?: string): UInt8Array
summary: Creates a Uint8Array object from a utf-8 string.
description: String input values return the actual encoded UInt8Array. null or undefined values returns an empty encoded array.
example:
import { stringToU8a } from '@polkadot/util';
stringToU8a('hello'); // [0x68, 0x65, 0x6c, 0x6c, 0x6f]
Parameters:
| Name | Type |
|---|---|
Optional value |
undefined |
Returns: Uint8Array