| 1 |
--- |
| 2 |
title: strings.Chomp |
| 3 |
description: Returns the given string, removing all trailing newline characters and carriage returns. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
aliases: [chomp] |
| 9 |
returnType: any |
| 10 |
signatures: [strings.Chomp STRING] |
| 11 |
aliases: [/functions/chomp] |
| 12 |
--- |
| 13 |
|
| 14 |
If the argument is of type `template.HTML`, returns `template.HTML`, else returns a `string`. |
| 15 |
|
| 16 |
```go-html-template |
| 17 |
{{ chomp "foo\n" }} → foo |
| 18 |
{{ chomp "foo\n\n" }} → foo |
| 19 |
|
| 20 |
{{ chomp "foo\r\n" }} → foo |
| 21 |
{{ chomp "foo\r\n\r\n" }} → foo |
| 22 |
``` |