11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

$CHARABCACYou can use decimal numeric values for expression. <strong>Caché</strong> ignores the decimal portion ofthe argument and only considers the integer portion. In the following example, $CHARignores the decimal portion of the number and produces the character represented by decimalASCII code 65, an uppercase A.WRITE $CHAR(65.5)Unicode Support$CHAR supports Unicode characters when represented by decimal integers.The Unicode value for a character is usually expressed as a 4-digit number in hexadecimalnotation, using the digits 0-9 and the letters A-F. However, standard functions in the <strong>Caché</strong><strong>ObjectScript</strong> language generally identify characters according to ASCII codes, which aredecimal values, not hexadecimal.Hence, the $CHAR function supports Unicode encoding by returning a character based onthe decimal Unicode value that was input, not the more standard hexadecimal value. Toconvert a decimal number to hexadecimal, use the $ZHEX function.Functions Related to $CHARThe $ASCII function is the inverse of $CHAR. You can use it to convert a character to itsequivalent decimal value. $ASCII converts all characters, including Unicode characters. Inaddition, all <strong>Caché</strong> platforms support the related functions, $ZLCHAR and $ZWCHAR.They are similar to $CHAR, but operate on a word (two bytes) or a long word (four bytes).You can use $ZISWIDE to determine if there are any multibyte (“wide”) characters in theexpression of $CHAR.See Also• READ command• WRITE command• $ASCII function• $ZHEX function• $ZLCHAR function• $ZWCHAR function<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 195

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!