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.

<strong>Caché</strong> <strong>ObjectScript</strong> FunctionsProviding No ParametersInvoking the $LISTBUILD function with no parameters returns a list with one element whosedata value is undefined. This is not the same as a null string:SET x=$LISTBUILD()SET y=$LISTBUILD("")ZZDUMP x,yreturns:0000: 01 .0000: 02 01 ..Nesting ListsAn element of a list may itself be a list. For example, the following statement produces athree-element list whose third element is the two-element list, "Walnut,Pecan":SET X=$LISTBUILD("Apple","Pear",$LISTBUILD("Walnut","Pecan"))WRITE $LIST(X,3)Concatenating ListsThe result of concatenating two lists with the Binary Concatenate operator is another list. Forexample, the following two WRITE statements produce the same list, "A,B,C":WRITE !,$LIST($LISTBUILD("A","B")_$LISTBUILD("C"),0,-1)WRITE !,$LIST($LISTBUILD("A","B","C"),0,-1)For further details, see Operators in Using <strong>Caché</strong> <strong>ObjectScript</strong>.A null string ("") is an empty list. For example, the following two expressions each producethe same two-element list:WRITE !,$LISTBUILD("A","B")_""WRITE !,$LISTBUILD("A","B")However, the following two expressions each produce a three-element list:WRITE !,$LISTBUILD("A","B")_$LISTBUILD("")WRITE !,$LISTBUILD("A","B")_$LISTBUILD()UnicodeIf one or more characters in a list element is a wide (Unicode) character, all characters in thatelement are represented as wide characters. To insure compatibility across systems,$LISTBUILD always stores these bytes in little-endian order, regardless of the hardwareplatform. Wide characters are represented as byte strings. Therefore, when displayed usingZZDUMP, the ZZDUMP length reflects the number of bytes, not the number of Unicodecharacters.246 <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!