github.com/rabbouni145/gg@v0.47.1/docs/content/en/functions/strings.TrimPrefix.md (about) 1 --- 2 title: strings.TrimPrefix 3 description: Returns a given string s without the provided leading prefix string. If s doesn't start with prefix, 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.TrimPrefix PREFIX STRING"] 14 workson: [] 15 hugoversion: 16 relatedfuncs: [strings.TrimSuffix] 17 deprecated: false 18 aliases: [] 19 --- 20 21 Given the string `"aabbaa"`, the specified prefix is only removed if `"aabbaa"` starts with it: 22 23 {{ strings.TrimPrefix "a" "aabbaa" }} → "abbaa" 24 {{ strings.TrimPrefix "aa" "aabbaa" }} → "bbaa" 25 {{ strings.TrimPrefix "aaa" "aabbaa" }} → "aabbaa"