DecodeHex

From Xojo Documentation

Method

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

Usage

result = DecodeHex (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 12 characters long but, as it uses UTF-8 as encoding, it is 14 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"

See Also

EncodeHex, Hex functions