strings.TrimSuffix.md (714B)
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 date: 2017-02-01 5 publishdate: 2017-02-01 6 lastmod: 2017-02-01 7 categories: [functions] 8 menu: 9 docs: 10 parent: "functions" 11 keywords: [strings] 12 signature: ["strings.TrimSuffix SUFFIX STRING"] 13 workson: [] 14 hugoversion: 15 relatedfuncs: [strings.TrimPrefix] 16 deprecated: false 17 aliases: [] 18 --- 19 20 Given the string `"aabbaa"`, the specified suffix is only removed if `"aabbaa"` ends with it: 21 22 {{ strings.TrimSuffix "a" "aabbaa" }} → "aabba" 23 {{ strings.TrimSuffix "aa" "aabbaa" }} → "aabb" 24 {{ strings.TrimSuffix "aaa" "aabbaa" }} → "aabbaa"