strings.TrimPrefix
Returns the given string, removing the prefix from the beginning of the string.
- Syntax
- strings.TrimPrefix PREFIX STRING
- Returns
- string
Usage
The strings.TrimPrefix function returns the given string, removing the prefix from the beginning of the string. If STRING does not begin with PREFIX, the function returns STRING unchanged.
Examples
{{ strings.TrimPrefix "a" "aabbaa" }} → abbaa
{{ strings.TrimPrefix "aa" "aabbaa" }} → bbaa
{{ strings.TrimPrefix "aaa" "aabbaa" }} → aabbaaLast updated:
November 8, 2026
:
content: Remove categories from front matter (1cc1dd83a)
Improve this page