Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section


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




dynarray An expression that resolves to a dynamic array.


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.


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.


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

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

PRINT SEQS(russian)
Copy code to clipboard

See Also