TrimEnd
trimEnd is a string manipulation operation used in several programming languages to remove characters from the end of a string. In most implementations it returns a new string, leaving the input unchanged. The exact characters removed depend on the language and the chosen overload.
Typically, the default behavior is to trim whitespace from the end. Some languages also provide overloads that
In JavaScript and TypeScript, trimEnd on a string removes trailing whitespace characters and returns a new
In Kotlin, trimEnd() removes trailing whitespace by default, and overloads let you specify characters to trim.
In C#, string.TrimEnd removes trailing characters; the parameterless version trims whitespace, while TrimEnd(params char[] trimChars) removes
In Rust, trim_end removes trailing whitespace; to remove specific trailing characters you can use trim_end_matches, e.g.,
In Java, the standard library offers stripTrailing() (Java 11+), which removes trailing Unicode whitespace. It does
See also: trim, trimStart, trimEnd across languages, and equivalents like rstrip in Python or stripTrailing in