Previous Topic: &INTREPL

Next Topic: &LBLSTR


&INVSTR

Returns a string that is the inverted form of the supplied text.

&INVSTR text

&INVSTR is a built-in function and must be used to the right of an assignment statement.

&INVSTR is used in an assignment statement to reverse the data order. For example, inverting the data 123456 assigns the nominated variable the data 654321.

Operands:

text

The data to be inverted and placed in the nominated variable. A maximum of data that is specified is the maximum length of the variable. The data is reversed and placed into the target variable of the assignment statement.

Examples: &INVSTR

&A = &INVSTR ABCDEF  -* &A will be set to FEDCBA
&1 = &INVSTR &1 &2

Notes:

&INVSTR is a simple way of stripping a number of characters from the end of a variable length string: use &INVSTR to invert the string, then &SUBSTR to strip the required number of characters from the front of the string. A second &INVSTR statement then returns the string to its original order.

&INVSTR is useful when constructing keys for file processing from data entered from a full-screen panel if the data entered must be reordered to construct a suitable key.

More information:

&CONCAT

&SELSTR

&STR