mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-21 10:47:34 -05:00
Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com> Signed-off-by: Damian Stasik <920747+damianstasik@users.noreply.github.com> Signed-off-by: Roman Grinovski <roman.grinovski@gmail.com> Co-authored-by: Damian Stasik <920747+damianstasik@users.noreply.github.com> Co-authored-by: Roman Grinovski <roman.grinovski@gmail.com>
28 lines
718 B
Plaintext
28 lines
718 B
Plaintext
---
|
|
sidebar_label: startswith
|
|
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.mdx) takes two values: a string to check and a suffix string. The function returns true if the first string ends with that exact suffix.
|