Functions

stringToU8a

▸ stringToU8a(value?: undefined | string): Uint8Array

Defined in string/toU8a.ts:39

name: stringToU8a

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]
1
2
3

Parameters:

Name Type
Optional value undefined | string

Returns: Uint8Array


Last Updated: 2/26/2019, 11:08:42 AM