See Character Functions in the JSL Syntax Reference for details.
Hex("text")
Hex("num")
Hex("blob")
Char To Hex is an alias.
Hex To Blob("hexstring")
Hex To Char("hexstring", "encoding")
The default encoding for the character string is utf-8. utf-16le, utf-16be, us-ascii, iso-8859-1, ascii~hex, shift-jis, and euc-jp are also supported.
Hex to Number
Char To Blob("string")
Char To Blob("string", "encoding")
The default encoding for the blob is utf-8. utf-16le, utf-16be, us-ascii, iso-8859-1, ascii~hex, shift-jis, and euc-jp are also supported.
Blob To Char("blob")
Blob To Char("blob", "encoding")
The default encoding for the character string is utf-8. utf-16le, utf-16be, us-ascii, iso-8859-1, ascii~hex, shift-jis, and euc-jp are also supported.
Blob Peek("blob", offset, length)
Returns a new BLOB that is a subset of the given BLOB that is length bytes long and begins at the offset. Note that the offset is 0-based.
Hex(string) returns the hexadecimal codes for each character in the argument. For example,
Hex( "Abc" );
"416263"
Hex to Char(string) converts hexadecimal to characters. The resulting character string might not be valid display characters. All the characters must be in pairs, in the ranges 0-9, A-Z, and a-z. Blanks and commas are allowed, and skipped. For example,
Hex To Char( "4142" );
"AB"
Hex and Hex To Char are inverses of each other, so
Hex To Char( Hex( "Abc" ) );
"Abc"
Hex To Blob(string) takes a string of hexadecimal codes and converts it to a binary object.
a = Hex To Blob( "6A6B6C" );
Show( a );
a = Char To Blob("jkl", "ascii~hex")
Blob Peek(blob,offset,length) extracts bytes as defined by the arguments from a blob.
b = Blob Peek( a, 1, 2 );
Show( b );
b = Char To Blob("kl", "ascii~hex")
b = Blob Peek( a, 0, 2 );
Show( b );
b = Char To Blob("jk", "ascii~hex")
b = Blob Peek( a, 2 );
Show( b );
b = Char To Blob("l", "ascii~hex")
Hex(blob) converts a blob into hexadecimal.
c = Hex( a );
Show( c );
c = "6A6B6C"
d = Hex To Char( c );
Show( d );
d = "jkl"
Concat(blob1,blob2) or blob1 || blob2 concatenates two blobs.
e = Hex To Blob( "6D6E6F" );
Show( e );
f = a||e;
Show( f );
e = Char To Blob("mno", "ascii~hex")
f = Char To Blob("jklmno", "ascii~hex")
Length(blob) returns the number of bytes in a blob.
g = Length( f );
Show( g );
g = 6
Any hex code outside the ASCII range (space to }, or hex 20 - 7D) is encoded as the three-character sequence [~][hexdigit][hexdigit]. For example,
h = Hex To Blob( "19207D7E" );
Show( h );
i = Hex( h );
Show( i );
h = Char To Blob("~19 }~7E", "ascii~hex")
i = "19207D7E"
Char To Blob(string) creates a blob from a string, converting ~hex codes. Blob To Char(blob) creates a string with ~hex codes to indicate non-visible and non-ASCII codes.