diff options
Diffstat (limited to 'docs/content/en/functions/strings/Chomp.md')
-rw-r--r-- | docs/content/en/functions/strings/Chomp.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/content/en/functions/strings/Chomp.md b/docs/content/en/functions/strings/Chomp.md new file mode 100644 index 000000000..349f1e9b7 --- /dev/null +++ b/docs/content/en/functions/strings/Chomp.md @@ -0,0 +1,27 @@ +--- +title: strings.Chomp +description: Returns the given string, removing all trailing newline characters and carriage returns. +categories: [] +keywords: [] +action: + aliases: [chomp] + related: + - functions/strings/Trim + - functions/strings/TrimLeft + - functions/strings/TrimPrefix + - functions/strings/TrimRight + - functions/strings/TrimSuffix + returnType: any + signatures: [strings.Chomp STRING] +aliases: [/functions/chomp] +--- + +If the argument is of type `template.HTML`, returns `template.HTML`, else returns a `string`. + +```go-html-template +{{ chomp | "foo\n" }} → foo +{{ chomp | "foo\n\n" }} → foo + +{{ chomp | "foo\r\n" }} → foo +{{ chomp | "foo\r\n\r\n" }} → foo +``` |