Caché MultiValue Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

Returns the character code corresponding to a specified character.
char An expression that resolves to a character or string. If char is a string, SEQ returns the value of the first character.
The SEQ function takes a character and returns the corresponding character code, a base-10 integer value. Its inverse, the CHAR function takes a numeric code and returns the corresponding character.
If char is the null string, SEQ returns -1. If char is a string the first character of which is either a space or a tab, SEQ returns 32.
The Caché MVBasic SEQ function returns the numeric value for a single character. 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.
SEQ and UNISEQ are functionally identical.
The following example uses the SEQ function to return the numeric code associated with the specified character:
PRINT SEQ('A');    ! Returns 65.
PRINT SEQ('a');    ! Returns 97.
PRINT SEQ('%');    ! Returns 37.
PRINT SEQ('>');    ! Returns 62.
The following example uses the SEQ function to return lowercase letter characters and associated numeric codes of the Russian alphabet. On a Unicode version of Caché it returns the Russian letters; on an 8-bit version of Caché it returns a -1 (indicating a null string) for each letter:
FOR x=1 TO 32
  PRINT SEQ(glyph),glyph
See Also