github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/job-specification/hcl2/functions/string/chomp.mdx (about) 1 --- 2 layout: docs 3 page_title: chomp - Functions - Configuration Language 4 description: The chomp function removes newline characters at the end of a string. 5 --- 6 7 # `chomp` Function 8 9 `chomp` removes newline characters at the end of a string. 10 11 This can be useful if, for example, the string was read from a file that has 12 a newline character at the end. 13 14 ## Examples 15 16 ```shell-session 17 > chomp("hello\n") 18 hello 19 > chomp("hello\r\n") 20 hello 21 > chomp("hello\n\n") 22 hello 23 ``` 24 25 ## Related Functions 26 27 - [`trimspace`](/docs/job-specification/hcl2/functions/string/trimspace), which removes all types of whitespace from 28 both the start and the end of a string.