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