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 corresponding to a specified character.




char An expression that resolves to a single character. If char is a string, UNISEQ returns the value of the first character.


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.


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.
Copy code to clipboard

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:

FOR x=1 TO 32
  PRINT UNISEQ(glyph),glyph
Copy code to clipboard

See Also