diff --git a/website/docs/language/functions/trimprefix.mdx b/website/docs/language/functions/trimprefix.mdx index 51b931bdb167..195cacd455a2 100644 --- a/website/docs/language/functions/trimprefix.mdx +++ b/website/docs/language/functions/trimprefix.mdx @@ -7,7 +7,7 @@ description: |- # `trimprefix` Function -`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. +`trimprefix` removes the specified prefix from the start of the given string, but only once. If the string does not begin with the prefix, the original string is returned unchanged. ## Examples @@ -21,6 +21,11 @@ world helloworld ``` +``` +> trimprefix("--hello", "-") +-hello +``` + ## Related Functions * [`trim`](/terraform/language/functions/trim) removes characters at the start and end of a string. diff --git a/website/docs/language/functions/trimsuffix.mdx b/website/docs/language/functions/trimsuffix.mdx index 31f12f225a5e..272d0cc48e7c 100644 --- a/website/docs/language/functions/trimsuffix.mdx +++ b/website/docs/language/functions/trimsuffix.mdx @@ -7,7 +7,7 @@ description: |- # `trimsuffix` Function -`trimsuffix` removes the specified suffix from the end of the given string. +`trimsuffix` removes the specified suffix from the end of the given string, but only once, even if the suffix appears multiple times. If the suffix does not appear at the very end of the string, the original string is returned unchanged. ## Examples @@ -16,6 +16,16 @@ description: |- hello ``` +``` +> trimsuffix("helloworld", "cat") +helloworld +``` + +``` +> trimsuffix("hello--", "-") +hello- +``` + ## Related Functions * [`trim`](/terraform/language/functions/trim) removes characters at the start and end of a string.