11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Caché</strong> <strong>ObjectScript</strong> FunctionsParameterexpressionThe expression can be an integer value, the name of a variable that contains an integer value,or any valid <strong>Caché</strong> <strong>ObjectScript</strong> expression that evaluates to an integer value. To returncharacters for multiple integer values, specify a comma-separated list of expressions.ExamplesThe following example uses $CHAR in a FOR loop to output the characters for all ASCIIcodes in the range 65 to 90. These are the uppercase alphabetic characters.FOR i=65:1:90 {WRITE !,$CHAR(i) }The following two examples show the use of multiple expression values. The first returns“AB” and the second returns “AaBbCcDdEeFfGgHhIiJjKk”:WRITE $CHAR(65,66),!FOR i=65:1:75 {WRITE $CHAR(i,i+32) }The following example shows the use of a multibyte character. The character correspondingto the integer 960 is the symbol for pi:WRITE $CHAR(960)Notes$CHAR with the WRITE CommandWhen you use $CHAR to write characters with the WRITE command, the output charactersreset the positions of the special variables $X and $Y. This is true even for the NULL character(ASCII 0), which is not the same as a null string (""). As a rule, you should use $CHARwith caution when writing nonprinting characters, because such characters may produceunpredictable cursor positioning and screen behavior.Numeric Values in $CHAR ArgumentsYou can use signed numeric values for expression. <strong>Caché</strong> ignores negative numbers and onlyevaluates positive or unsigned numbers. In the following example, the $CHAR with signedintegers returns only the first and third expression, ignoring the second expression, which isa negative integer.WRITE !,$CHAR(65,66,67)WRITE !,$CHAR(+65,-66,67)194 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!