Method

DecodeHex


Description

Decodes the passed String into hex. Invalid hex values will be discarded.

Usage

result = DecodeBase64(s)

Part

Type

Description

result

String

The passed string decoded into a hex string.

s

String

The string to be decoded into hex.

Notes

Hexadecimal encoded strings are byte-based instead of character-based, i.e. they ignore text encodings. For example, the string "Xojo™" is 5 characters long but, as it uses UTF-8 as encoding, it is 7 bytes long (the ™ character uses 3 bytes in UTF-8). You should keep that in mind when using EncodeHex and DecodeHex.

Only a hexadecimal string made from a UTF-8 string will be transformed back properly by DecodeHex.

Sample code

The following converts a hex string back into a letter.

Var s As String
s = DecodeHex("61") //returns "a"

Compatibility

All project types on all supported operating systems.

See also

EncodeHex, Hex functions