There are several ways to do this.
If you already know at what position string2 appears within string1 (which you do above -- it appears starting at the first character), then you can use the DELSTR function:string1 = DELSTR(string1, LENGTH(string2)+1) The above instruction should return the remaining part of string1, and reassign it to the string1 variable. (If you don't want to alter the original value of string1, then assign DELSTR's return value to a different variable).
Since the position happens to be at the very first character (ie, the rightmost character), you could also use the RIGHT function to do the same thing:string1 = RIGHT(string1, LENGTH(string1) - LENGTH(string2)) If you don't know where string2 appears within string1, then you could use the POS function to find out where it starts, and then use that position with DELSTR:position = POS(string2, string1)
IF position \= 0 THEN
string1 = DELSTR(string1, position, LENGTH(string2)) If you know that string1 appears once and only once within string1, then you can replace the above two instructions with:string1 = CHANGESTR(string2, string1, "") But note that if string2 appears more than once, then all of those occurences will be removed with CHANGESTR. (You can use COUNTSTR to check if string2 appears more than once).
Thats it I hope.
Rexx is a great language for string manipulation.
K?re
P.S. One strange thing with our example is that ELK disapeared. Why? |