strings.TrimSuffix
Returns the given string, removing the suffix from the end of the string.
- Syntax
- strings.TrimSuffix SUFFIX STRING
- Returns
- string
Usage
The strings.TrimSuffix function returns the given string, removing the suffix from the end of the string. If STRING does not end with SUFFIX, the function returns STRING unchanged.
Examples
{{ strings.TrimSuffix "a" "aabbaa" }} → aabba
{{ strings.TrimSuffix "aa" "aabbaa" }} → aabb
{{ strings.TrimSuffix "aaa" "aabbaa" }} → aabbaaLast updated:
October 28, 2026
:
content: Apply style guide to strings functions (d6de31ebd)
Improve this page