mirror of https://github.com/hashicorp/terraform
Merge pull request #31220 from FooBartn/string-starts-ends-with-funcs
feat: add startswith and endswith funcspull/31444/head
commit
d3284bdc4e
@ -0,0 +1,27 @@
|
||||
---
|
||||
page_title: endswith - Functions - Configuration Language
|
||||
description: |-
|
||||
The endswith function takes two values: a string to check and a suffix string. It returns true if the first string ends with that exact suffix.
|
||||
---
|
||||
|
||||
# `endswith` Function
|
||||
|
||||
`endswith` takes two values: a string to check and a suffix string. The function returns true if the first string ends with that exact suffix.
|
||||
|
||||
```hcl
|
||||
endswith(string, suffix)
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
> endswith("hello world", "world")
|
||||
true
|
||||
|
||||
> endswith("hello world", "hello")
|
||||
false
|
||||
```
|
||||
|
||||
## Related Functions
|
||||
|
||||
- [`startswith`](/language/functions/startswith) takes two values: a string to check and a prefix string. The function returns true if the string begins with that exact prefix.
|
||||
@ -0,0 +1,27 @@
|
||||
---
|
||||
page_title: startsswith - Functions - Configuration Language
|
||||
description: |-
|
||||
The startswith function takes two values: a string to check and a prefix string. It returns true if the string begins with that exact prefix.
|
||||
---
|
||||
|
||||
# `startswith` Function
|
||||
|
||||
`startswith` takes two values: a string to check and a prefix string. The function returns true if the string begins with that exact prefix.
|
||||
|
||||
```hcl
|
||||
startswith(string, prefix)
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
> startswith("hello world", "hello")
|
||||
true
|
||||
|
||||
> startswith("hello world", "world")
|
||||
false
|
||||
```
|
||||
|
||||
## Related Functions
|
||||
|
||||
- [`endswith`](/language/functions/endswith) takes two values: a string to check and a suffix string. The function returns true if the first string ends with that exact suffix.
|
||||
Loading…
Reference in new issue