Function: RSplit
Description
Starts on the right and splits string into maxparts number of parts using sep as the separator (the separator may be a single character or a substring), returning part n.
Syntax
RSplit(string,maxparts,sep,n)
Arguments
string is the string you want to split apart. The string can be a constant, a character field, an expression that results in a string, or a function that returns a string.
maxparts represents the maximum number of substrings you want to parse the string into. This value can be a constant, a numeric field, an expression that results in a number, or a function that returns a number.
sep is the separator that tells Monarch Classic where to split the string. The separator may be a single character or a substring.
n tells Monarch Classic which substring (from the right) you want the function to return. This value can be a constant, a numeric field, an expression that results in a number, or a function that returns a number.
Return value
This function returns a character string.
Calculated field example
If the Home field contained the value 6rm, ranch, split, attached garage, the following calculated field expression would return attached garage: RSplit(Home,2,",",1)
The first argument, Home, specifies the field. The second argument (2) tells Monarch Classic to split the field into a maximum of 2 substrings. The third argument (",") tells Monarch Classic where to split the field, in this case on the rightmost comma (between "6rm, ranch, split" and " attached garage". The fourth argument (1) tells Monarch Classic which substring to return, in this case the first substring from the right, " attached garage".
Note: In this example it makes sense to split the field based upon the comma delimiter. You can use any character as the delimiter, but be careful, Monarch Classic does not include the delimiter when it breaks out each substring.
Filter/Find example
Records with a Home field value of 6rm, ranch, split, attached garage or 7rm, colonial, attached garage can be selected or found using the expression: RSplit(Home,2,",",1)=" attached garage"