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.
This commit is contained in:
parent
43737f2f4f
commit
edbf59ed4c
|
@ -13,7 +13,7 @@ description: |-
|
||||||
earlier, see
|
earlier, see
|
||||||
[0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html).
|
[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
|
## Examples
|
||||||
|
|
||||||
|
@ -22,6 +22,11 @@ earlier, see
|
||||||
world
|
world
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
> trimprefix("helloworld", "cat")
|
||||||
|
helloworld
|
||||||
|
```
|
||||||
|
|
||||||
## Related Functions
|
## Related Functions
|
||||||
|
|
||||||
* [`trim`](./trim.html) removes characters at the start and end of a string.
|
* [`trim`](./trim.html) removes characters at the start and end of a string.
|
||||||
|
|
Loading…
Reference in New Issue