String Functions
Text Processing
The functions of this package allow you to implement basic text processing to extract, to transform, to search strings from parameters or other field values
LENGTH(strval) or SIZE(strval): size of a string
This function returns the number of characters of the parameter strval.
Example:
- LENGTH(HELLO) returns 5.
- LENGTH(1.5) returns 3.
PREFIX(strval,n): Prefix extraction
This function extracts the first n positions from the string strval.
Example:
- PREFIX(HELLO,2) returns HE
- PREFIX(HELLO,12) returns HELLO
SUFFIX(strval,n): Suffix extraction
This function extracts the suffix made of the last n positions from the string strval.
Example:
- SUFFIX(HELLO,2) returns LO
SUBSTR(strval,pos,n): Substring extraction
This function allows to extract from the parameter "strval" the substring starting at the character of rank "pos" and of length "n". Note that the first rank of the string is 0. Example: SUBSTR(HELLO,2,2) returns LL
REPLACE(strval,pattern,strReplace): Substring substitution
This function allows to replace by "strReplace" all the substrings of "strval" that match the regular expression "pattern".
Example: "REPLACE(The answer is 123 or 456,[0-9]+,X)" returns "The answer is X or X"
LOWER(strval): Lowercase conversion
This function allows to convert the parameter "strval" into lowercase. If a character from strval cannot be put into lowercase, its value remains the same.
Example: "LOWER(HELLO!)" returns "hello!"
UPPER(strval): Uppercase conversion
This function allows to convert the parameter "strval" into uppercase. If a character from strval cannot be put into uppercase, its value remains the same.
Example: "UPPER(Hello!)" returns "HELLO!"
LTRIM(strval,pattern): prefix removal(left trimering)
This function allows to remove the biggest prefix of "strval" matching the regular expression "pattern".
Example: "LTRIM(YYYHELLOXXX,[Y]+)" returns "HELLOXXX"
RTRIM(strval,pattern): suffix removal (right trimering)
This function allows to remove the biggest suffix of "strval" matching the regular expression "pattern".
Example: "RTRIM(YYYHELLOXXX,[X]+)" returns "YYYHELLO"
MATCH(pattern,strval): pattern matching
This function allows to test wether the string "strval" matches the regular expression "pattern". Note that the whole string must match with the pattern, not only a substring. Examples: "MATCH([X]+,HELLOXXX)" returns "false". MATCH([0-9]+,SUM(25,MULT(2,4))) returns true.
FORMAT(StrVal,left|right,Size,Compl) : string formatting
This function allows to format the string "StrVal" such that its size is equal to "Size".
If "Size" is greater than the actual size of "StrVal" then the character "Compl" will be added to "StrVal" either as a prefix or a suffix, depending on the specified direction (left or right).
If "Size" is smaller the the size of "StrVal", then the prefix or suffix of length "Size" is extracted, depending on the specified direction.
Example:
- FORMAT(HELLO,left,8,X) returns "XXXHELLO"
- FORMAT(HELLO,right,2,_) returns "LO"



