bytes->importString

Imports string data into bytes.

Target member

Signature

1bytes->importString(s::string, enc::string= ?)

Imports string data into bytes.

bytes->importString is called with member syntax on a receiver value. bytes->importString works with binary values. Convert strings to bytes before byte-level hashing or encoding, then convert back to a string only for display or transport.

Parameters

s
Required value of type string. Supply s positionally unless the signature shows a keyword form.
enc
Optional value of type string. Supply enc positionally unless the signature shows a keyword form.

Examples

Basic call

1local(b) = bytes2#b->importString('Ada', 'UTF-8')
The example keeps binary work on bytes and converts only when text output is needed.