Generic Action: String Manipulation Operations and Examples

Last Updated : Mar 20, 2024 |
Prolog information
The following options can be selected for the Select Operation setting when using a Generic action set to String Manipulation.

Copy

Return the portion of the string before or after the first or last occurrence of the indicated character or characters to match.
Selected Input Variable ($CP0)
Free Format Command
Result Variable ($CP1)
01555364200
STRING:$CP1=copy($CPO)
01555364200
STRING:$CP1=copytofirst($CPO,1)
01
STRING:$CP1=copyfromfirst($CPO,5)
555364200
STRING:$CP1=copytolast($CPO,5)
01555
STRING:$CP1=copyfromlast($CPO,5)
5364200

From Position

Return the selected number of characters starting from the position index and going right.
Selected Input Variable ($CP0)
Free Format Command
Result Variable ($CP1)
01555364200
STRING:$CP1=mid($CP0,3,3)
555

From the Left

Return the selected number of characters starting from the left end.
Selected Input Variable ($CP0)
Free Format Command
Result Variable ($CP1)
01555364200
STRING:$CP1=left($CP0,5)
01555

From the Right

Return the selected number of characters starting from the right end.
Selected Input Variable ($CP0)
Free Format Command
Result Variable ($CP1)
01555364200
STRING:$CP1=right($CP0,5)
64200

Length

Return the length of the string before or after the first or last occurrence of the indicated character or characters to match.
Selected Input Variable ($CP0)
Free Format Command
Result Variable ($CP1)
01555364200
STRING:$CP1=length($CPO)
11
STRING:$CP1=lengthtofirst($CPO,5)
2
STRING:$CP1=lengthfromfirst($CPO,5)
9
STRING:$CP1=lengthtolast($CPO,5)
5
STRING:$CP1=lengthfromlast($CPO,5)
7

Lowercase

Change any uppercase characters in the input into lowercase.
Selected Input Variable ($CP0)
Free Format Command
Result Variable ($CP1)
ABCdef123
STRING:$CP1=lower($CP0)
abcdef123

Reverse

Reverse the order of characters in the input.
Selected Input Variable ($CP0)
Free Format Command
Result Variable ($CP1)
ABCdef123
STRING:$CP1=reverse($CP0)
321fedCBA

Uppercase

Change any lowercase characters in the input into uppercase.
Selected Input Variable ($CP0)
Free Format Command
Result Variable ($CP1)
ABCdef123
STRING:$CP1=upper($CP0)
ABCDEF123