github.com/hugorut/terraform@v1.1.3/website/docs/language/functions/trimprefix.mdx (about) 1 --- 2 page_title: trimprefix - Functions - Configuration Language 3 description: |- 4 The trimprefix function removes the specified prefix from the start of a 5 given string. 6 --- 7 8 # `trimprefix` Function 9 10 `trimprefix` removes the specified prefix from the start of the given string. If the string does not start with the prefix, the string is returned unchanged. 11 12 ## Examples 13 14 ``` 15 > trimprefix("helloworld", "hello") 16 world 17 ``` 18 19 ``` 20 > trimprefix("helloworld", "cat") 21 helloworld 22 ``` 23 24 ## Related Functions 25 26 * [`trim`](/language/functions/trim) removes characters at the start and end of a string. 27 * [`trimsuffix`](/language/functions/trimsuffix) removes a word from the end of a string. 28 * [`trimspace`](/language/functions/trimspace) removes all types of whitespace from 29 both the start and the end of a string.