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.

$REVERSE$REVERSEReturns the characters in a string in reverse order.$REVERSE(string)$RE(string)ParameterstringA string or expression that evaluates to a string.Description$REVERSE returns the characters in string in reverse order.ExamplesThe following WRITE commands shows the return value from $REVERSE. The first returns“CBA”, the second returns 321.WRITE !,$REVERSE("ABC")WRITE !,$REVERSE(123)You can use the $REVERSE function with other functions to perform search operationsfrom the end of the string. The following example demonstrates how you can use $REVERSEwith the $FIND and $LENGTH functions to locate the position of a word within a line oftext. It returns 33:SET line="THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG."SET position=$L(line)+2-$F($RE(line),$RE("THE"))WRITE "The second THE in the line begins at ",positionSee Also• $FIND function• $EXTRACT function• $LENGTH function• $PIECE function<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 295

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

Saved successfully!

Ooh no, something went wrong!