Returns the characters in a string in reverse order.
Examples
The 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 operations from the end of the string. The following example demonstrates how you can use $REVERSE with the $FIND and $LENGTH functions to locate the last example of a string within a line of text. It returns the position of that string as 33:
SET line="THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG."
SET position=$LENGTH(line)+2-$FIND($REVERSE(line),$REVERSE("THE"))
WRITE "The last THE in the line begins at ",position