bytes->asString

Converts bytes to a string.

Target member

Signature

1bytes->asString(encoding::string= ?)

Converts bytes to a string.

bytes->asString is called with member syntax on a receiver value. bytes->asString 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

encoding
Optional value of type string. Supply encoding positionally unless the signature shows a keyword form.

Examples

Basic call

1bytes('Ada')->asString('UTF-8')
The example keeps binary work on bytes and converts only when text output is needed.