github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/chomp.html.md (about) 1 --- 2 layout: "functions" 3 page_title: "chomp - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-string-chomp" 5 description: |- 6 The chomp function removes newline characters at the end of a string. 7 --- 8 9 # `chomp` Function 10 11 -> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and 12 earlier, see 13 [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html). 14 15 `chomp` removes newline characters at the end of a string. 16 17 This can be useful if, for example, the string was read from a file that has 18 a newline character at the end. 19 20 ## Examples 21 22 ``` 23 > chomp("hello\n") 24 hello 25 > chomp("hello\r\n") 26 hello 27 > chomp("hello\n\n") 28 hello 29 ``` 30 31 ## Related Functions 32 33 * [`trimspace`](./trimspace.html), which removes all types of whitespace from 34 both the start and the end of a string.