RTRIM() removes specified characters from the right side of a string. It iteratively removes characters that match any character in the provided list, starting from the rightmost position. If no list is provided, it removes spaces by default. This function is similar to TRIM() and LTRIM(), but operates only on the right side of the string.
RTRIM(string [, list])
RTRIM() returns a character string
// Removing spaces (default)
RTRIM(" APPLES ") = " APPLES"
// Removing single character
RTRIM("APPLES", "S") = "APPLE"
// Removing multiple characters
RTRIM("APPLES", "SE") = "APPL"
RTRIM("APPLES", "ES") = "APPL"
// No matching characters
RTRIM("APPLES", "E") = "APPLES"
// Complex character removal
RTRIM("APPLES", "ELP") = "APPLES"
RTRIM("APPLES", "ELPS") = "A"
RTRIM("ABRACADABRA", "ARBD") = "ABRAC"
RTRIM("ABRACADABRA", "ARBDC") = ""