EncodeHex
From Real Software Documentation
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 "Real Studio™" 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.
dim s as string
s = EncodeHex( "Real Studio™", true )
//s value is "52 65 61 6C 20 53 74 75 64 69 6F E2 84 A2" (14 values separated by a space)
s = EncodeHex( "Real Studio™", true )
//s value is "52 65 61 6C 20 53 74 75 64 69 6F E2 84 A2" (14 values separated by a space)
Examples
The following shows what happens when using false for the insertSpaces parameters.
