UNISEQ
Synopsis
UNISEQ(char)
Arguments
char | An expression that resolves to a single character. If char is a string, UNISEQ returns the value of the first character. |
Description
The UNISEQ function takes a character and returns the corresponding Unicode numeric code. Its inverse, the CHAR function takes a numeric code and returns the corresponding character.
The Caché MVBasic UNISEQ 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.
UNISEQ and SEQ are functionally identical.
Examples
The following example uses the UNISEQ function to return the numeric code associated with the specified character:
PRINT UNISEQ('A'); ! Returns 65.
PRINT UNISEQ('a'); ! Returns 97.
PRINT UNISEQ('%'); ! Returns 37.
PRINT UNISEQ('>'); ! Returns 62.
The following example uses the UNISEQ 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 UNISEQ(glyph),glyph
letter=letter+1
NEXT