StringToHex

This function converts the specified string into its hex equivalent.

Arguments

StringToHex(1,2)

Ordinal Type Required Description
1 String True String to convert
2 String False Optional .NET character-encoding type to utilize in conversion. Valid values are UTF-8 (default) and UTF-16.

Example

%%[

var @string1
var @string1Hex

set @string1 = "limedash"
set @string1Hex  = StringToHex(@string1)

set @string2 = "loyalty"
set @string2Hex  = StringToHex(@string2, "UTF-16")

]%%
string1: %%=v(@string1)=%%
<br>string1Hex: %%=v(@string1Hex)=%%
<br>string2: %%=v(@string2)=%%
<br>string2Hex: %%=v(@string2Hex)=%%

Output

string1: limedash
string1Hex: 6c696d6564617368
string2: loyalty
string2Hex: 6c006f00790061006c0074007900