Chapter 4

Advanced Expressions: Evaluating Text

91

The difference between “abc” and “abd” is -1 (based on the third pair-wise character comparison).

The difference between “@” and “abc” is -33.

The difference between “1” and “abc” is -47.

The following is the syntax for the COMPARE operation.

text.COMPARE("string")

Extracting the nth Integer from a String of Bytes that Represent Text

You can use the following operators to treat a string of bytes that represent text as

asequence of 8-bit, 16-bit, or 32-bit signed or unsigned integers, and then extract the nth integer from the sequence.

Operations for Extracting the nth Integer from a String of Bytes that Represent Text

Operation

Description

 

 

text.GET_SIGNED16(n,

Treats the string of bytes represented by text as a sequence of

endianness)

16-bit signed integers and returns the nth integer. The second

 

argument takes a value of 0 for little endian or 1 for big

 

endian.

 

 

text.GET_SIGNED32(n,

Treats the string of bytes represented by text as a sequence of

endianness)

32-bit signed integers and returns the nth integer. The second

 

argument takes a value of 0 for little endian or 1 for big

 

endian.

text.GET_SIGNED8(n)

Treats the string of bytes represented by text as a sequence of

 

8-bit signed integers and returns the nth integer.

text.GET_

Treats the string of bytes represented by text as a sequence of

UNSIGNED16(n,

16-bit unsigned integers and returns the nth integer. The

endianness)

second argument takes a value of 0 for little endian or 1 for

 

big endian.

text.GET_

Treats the string of bytes represented by text as a sequence of

UNSIGNED8(n)

8-bit unsigned integers and returns the nth integer.

Converting Text to a Hash Value

You can convert a text string to a hash value by using the .HASH operator. This operator returns a 31-bit positive integer as a result of the operation. Following is the format of the expression:

text.HASH

This operator ignores case and white spaces. For example, after the operation, the two strings "Ab c" and "a bc" would produce the same hash value.

Page 105
Image 105
Citrix Systems 9.2 manual Converting Text to a Hash Value, Operation Description