github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/trim.html.md (about) 1 --- 2 layout: "functions" 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 -> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and 13 earlier, see 14 [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html). 15 16 `trim` removes the specified characters from the start and end of the given 17 string. 18 19 ## Examples 20 21 ``` 22 > trim("?!hello?!", "!?") 23 hello 24 ``` 25 26 ## Related Functions 27 28 * [`trimprefix`](./trimprefix.html) removes a word from the start of a string. 29 * [`trimsuffix`](./trimsuffix.html) removes a word from the end of a string. 30 * [`trimspace`](./trimspace.html) removes all types of whitespace from 31 both the start and the end of a string.