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.

ParametersnumA string value or a numeric value, a variable that contains a string value or a numeric value,or an expression that evaluates to a string value or a numeric value.A string value is read as a hexadecimal number and converted to a positive decimal integer.$ZHEX recognizes both uppercase and lowercase letters “A” through “F” as hexadecimaldigits. It truncates leading zeros. It does not recognize plus and minus signs or decimal points.It stops evaluation of a string when it encounters a non-hexadecimal character. Therefore,the strings “F”, “f”, “00000F”, “F.7”, and “FRED” all evaluate to decimal 15. If the firstcharacter encountered in a string is not a hexadecimal character, $ZHEX evaluates the stringas zero. Therefore, the strings “0”, “0.9”, “+F”, “-F”, and “H” all evaluate to zero. The nullstring ("") is an invalid value and returns a error.An integer value is read as a decimal number and converted to hexadecimal. An integer canbe positive or negative. $ZHEX recognizes leading plus and minus signs. It truncates leadingzeros. It evaluates nested arithmetic operations. However, it does not recognize decimalpoints. It returns a error if it encounters a decimal point character. Therefore,the integers 217, 0000217, +217, -+-217 all evaluate to hexadecimal D9. -217, -0000217,and -+217 all evaluate to FFFFFFFFFFFFFF27 (the twos complement). Other values, suchas floating point numbers, trailing signs, and non-numeric characters result in a or error.ExamplesWRITE $ZHEX("F")returns 15.WRITE $ZHEX(15)returns F.WRITE $ZHEX("1AB8")returns 6840.WRITE $ZHEX(6840)returns 1AB8.WRITE $ZHEX("XXX")$ZHEX<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 367

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

Saved successfully!

Ooh no, something went wrong!