Skip to main content
Previous sectionNext section

UNISEQS

Returns the character code for the first character of each element in a dynamic array.

Synopsis

UNISEQS(dynarray)

Arguments

dynarray An expression that resolves to a dynamic array.

Description

The UNISEQS function takes a dynamic array of characters and returns a dynamic array containing the corresponding numeric code for the first character in each element. If an element consists of a string of more than one character, UNISEQS returns the numeric value of the first character of that element. If an element is missing or contains the null string, UNISEQS returns -1 for that element.

If the first character of a dynamic array element is one of the following dynamic array level delimiters: CHAR(252), CHAR(253), or CHAR(254), UNISEQS treats this character as a level delimiter, and returns -1 for the null element(s) established by parsing this character as a level delimiter.

Note:

UNISEQS and SEQS are functionally identical. On Unicode systems both can be used to return character codes for 16-bit Unicode characters. On 8-bit systems, these functions return that character code of the first 8 bits of a 16-bit Unicode character.

The UNICHARS function is the inverse of UNISEQS. It takes a dynamic array of numeric codes and returns the corresponding characters.

The UNISEQ function (or SEQ function) takes the first character of a string and returns the corresponding numeric code.

The UNISEQS function returns the numeric value for the first character of each element as a dynamic array element. The corresponding ObjectScript $ASCII function can take a string of characters and return the numeric value for a specific character by specifying its position in the string.

Examples

The following example uses the UNISEQS function to return the numeric codes associated with each character in a dynamic array:

alpha="A":@VM:"B":@VM:"C":@VM:"D"
PRINT UNISEQS(alpha)
      ! returns 65ý66ý67ý68
Copy code to clipboard

The following example returns the numeric codes associated with four lowercase Russian letters in a dynamic array. On a Unicode system, it returns the Russian character codes. On an 8-bit system, characters beyond 255 are treated as null strings, so UNISEQS returns -1 for each element.

russian=CHAR(1072):@VM:CHAR(1073):@VM:CHAR(1074):@VM:CHAR(1075)
PRINT UNISEQS(russian)
Copy code to clipboard

See Also