github.com/rabbouni145/gg@v0.47.1/docs/content/en/functions/strings.TrimSuffix.md (about) 1 --- 2 title: strings.TrimSuffix 3 description: Returns a given string s without the provided trailing suffix string. If s doesn't end with suffix, s is returned unchanged. 4 godocref: 5 date: 2017-02-01 6 publishdate: 2017-02-01 7 lastmod: 2017-02-01 8 categories: [functions] 9 menu: 10 docs: 11 parent: "functions" 12 keywords: [strings] 13 signature: ["strings.TrimSuffix SUFFIX STRING"] 14 workson: [] 15 hugoversion: 16 relatedfuncs: [strings.TrimPrefix] 17 deprecated: false 18 aliases: [] 19 --- 20 21 Given the string `"aabbaa"`, the specified suffix is only removed if `"aabbaa"` ends with it: 22 23 {{ strings.TrimSuffix "a" "aabbaa" }} → "aabba" 24 {{ strings.TrimSuffix "aa" "aabbaa" }} → "aabb" 25 {{ strings.TrimSuffix "aaa" "aabbaa" }} → "aabbaa"