strings.from_hex

Supported in:
strings.from_hex(hex_string)

Description

Returns the bytes associated with the given hex string.

Param data types

STRING

Return type

BYTES

Code samples

Get bytes associated with a given hex string.

Example 1

This example shows non-hex character conversions.

strings.from_hex("str") // returns empty bytes
Example 2

This example shows input with empty string.

strings.from_hex("") // returns empty bytes
Example 3

This example shows hex string conversion.

strings.from_hex("1234") // returns 1234 bytes
Example 4

This example shows non-ASCII characters conversion.

strings.from_hex("筒纸.中国") // returns empty bytes