You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform/website/docs/language/functions/startswith.mdx

33 lines
1.3 KiB

---
page_title: startswith - 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.
---
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
> [!IMPORTANT]
> **Documentation Update:** Product documentation previously located in `/website` has moved to the [`hashicorp/web-unified-docs`](https://github.com/hashicorp/web-unified-docs) repository, where all product documentation is now centralized. Please make contributions directly to `web-unified-docs`, since changes to `/website` in this repository will not appear on developer.hashicorp.com.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
# `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`](/terraform/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.