Is it possible to trim a specific string of characters from the end of an existing string? I know you can use rtrim() to strip characters off, but rtrim() reads a character, one at a time, comparing it to the end of the string. I want to eliminate an entire string (and ONLY that string) from the end of the string in question.
Example:
I have a string that looks like this:
2:E,9,4:B+C,5-D,6:C+G&D,12:0+E,8:E
I want to trim ,9,4:B+C,5-D,6:C+G&D,12:0+E,8:E off the end so that it leaves only 2:E. However, if I did rtrim($string,',9,4:B+C,5-D,6:C+G&D,12:0+E,8:E'); It would eat up everything, because "2," ":," and "E," are all contained in the trim parameters. Does that make sense? I'm basically looking for a literal trim kind of function.
Thanks.