github.com/jaredpalmer/terraform@v1.1.0-alpha20210908.0.20210911170307-88705c943a03/website/docs/language/functions/trim.html.md (about) 1 --- 2 layout: "language" 3 page_title: "trim - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-string-trim" 5 description: |- 6 The trim function removes the specified characters from the start and end of 7 a given string. 8 --- 9 10 # `trim` Function 11 12 `trim` removes the specified characters from the start and end of the given 13 string. 14 15 ## Examples 16 17 ``` 18 > trim("?!hello?!", "!?") 19 hello 20 ``` 21 22 ## Related Functions 23 24 * [`trimprefix`](./trimprefix.html) removes a word from the start of a string. 25 * [`trimsuffix`](./trimsuffix.html) removes a word from the end of a string. 26 * [`trimspace`](./trimspace.html) removes all types of whitespace from 27 both the start and the end of a string.