Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?

SEQS

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

Synopsis

SEQS(dynarray)

Arguments

dynarray An expression that resolves to a dynamic array.

Description

The SEQS function takes a dynamic array and returns the corresponding numeric codes for the first character in each element. It returns these character codes as a dynamic array. If an element consists of a string of more than one character, SEQS returns the numeric value of the first character of that element. If an element is missing or contains the null string, SEQS returns -1 for that element. If an element is a string the first character of which is either a space or a tab, SEQS returns 32.

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), SEQS 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 CHARS function is the inverse of SEQS. It takes a dynamic array of numeric codes and returns the corresponding characters.

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

The SEQS 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 SEQS function to return the numeric codes associated with each character in a dynamic array:

alpha="A":@VM:"B":@VM:"C":@VM:"D"
PRINT SEQS(alpha)
      ! returns 65ý66ý67ý68

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 SEQS returns -1 for each element.

russian=CHAR(1072):@VM:CHAR(1073):@VM:CHAR(1074):@VM:CHAR(1075)
PRINT SEQS(russian)

See Also

Feedback