RightTrim
RightTrim is a term used in string processing to describe an operation that removes trailing characters from the right end of a string. The most common target is whitespace, but some implementations allow a custom set of characters to be removed.
In practice the exact name and behavior vary by language. For example, PHP provides rtrim, JavaScript offers
How it works: starting from the end of the string, the function checks whether each character is
Common use cases include removing trailing whitespace after user input, stripping end-of-line markers in text processing,