From edbf59ed4c62984fbf7668ac6c9f04826102b65f Mon Sep 17 00:00:00 2001 From: jessica-ritter <43350395+jessica-ritter@users.noreply.github.com> Date: Mon, 22 Jun 2020 11:31:08 -0700 Subject: [PATCH] what happens when prefix is not in string https://github.com/hashicorp/terraform/blob/master/lang/functions.go#L126 shows that Terraform's Trimprefix comes directly from the standard go library. When prefix is absent in the go standard library, the original string is returned; https://golang.org/pkg/strings/#TrimPrefix. --- website/docs/configuration/functions/trimprefix.html.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/website/docs/configuration/functions/trimprefix.html.md b/website/docs/configuration/functions/trimprefix.html.md index f2198834f..cc9e8a0e6 100644 --- a/website/docs/configuration/functions/trimprefix.html.md +++ b/website/docs/configuration/functions/trimprefix.html.md @@ -13,7 +13,7 @@ description: |- earlier, see [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html). -`trimprefix` removes the specified prefix from the start of the given string. +`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. ## Examples @@ -22,6 +22,11 @@ earlier, see world ``` +``` +> trimprefix("helloworld", "cat") +helloworld +``` + ## Related Functions * [`trim`](./trim.html) removes characters at the start and end of a string.