EncodeHex

From Xojo Documentation
Jump to: navigation, search
Method

Returns the passed String as hex values with the option of separating each hex value in the result with a space.

Syntax

result=EncodeHex (s, insertSpaces = False)

Part Type Description
result String The passed string as a series of Hex values.
s String The string to be encoded into hex.
insertSpaces Boolean If True, each hex value in result will be separated by a space. The default is False.

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.

Examples

Generate a hex string without spaces:

Dim s As String
s = EncodeHex("The cake is a lie.", False)
// s is "5468652063616B652069732061206C69652E"

See Also

DecodeHex, Hex functions.

Personal tools
Namespaces

Variants
Actions
Main
Content
Starting Out
Dig Deeper
More Help
Toolbox
About