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.

System and Other FunctionsExampleThe following example determines the numeric interpretation of the character string "ab":WRITE $ZWASCII("ab")It returns 25185.The following examples also return 25185:WRITE !,$ZWASCII("ab",1)WRITE !,$ZWASCII("abxx",1)WRITE !,$ZWASCII("xxabxx",3)In the following examples, string or position are invalid. The $ZWASCII function returns–1 in each case:WRITE !,$ZWASCII("a")WRITE !,$ZWASCII("aba",3)WRITE !,$ZWASCII("ababab",99)WRITE !,$ZWASCII("ababab",0)WRITE !,$ZWASCII("ababab",-1)Notes$ZWASCII and $ASCII$ZWASCII is similar to $ASCII except that it operates on 16-bit words instead of 8-bitbytes. To operate on 32-bit double words, use the $ZLASCII function.$ZWASCII(string,position) is the functional equivalent of:$ASCII(string,position+1)*256+$ASCII(string,position)$ZWASCII and $ZWCHARThe $ZWCHAR function is the logical inverse of $ZWASCII. For example:WRITE $ZWASCII("ab")returns: 25185.WRITE $ZWCHAR(25185)returns “ab”.See Also• $ASCII function• $ZWCHAR function728 <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!