Caché MultiValue Basic Reference
SEQ
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Returns the character code corresponding to a specified character.
Synopsis
SEQ(char)
Arguments
char An expression that resolves to a character or string. If char is a string, SEQ returns the value of the first character.
Description
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 Caché 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.
Note:
SEQ and UNISEQ are functionally identical.
Examples
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:
letter=1072
FOR x=1 TO 32
  glyph=CHAR(letter)
  PRINT SEQ(glyph),glyph
  letter=letter+1
NEXT
See Also