> ## Documentation Index
> Fetch the complete documentation index at: https://errand.nuvrel.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# startswith

> Check whether a string starts with a given prefix.

`startswith(str, prefix)` returns `true` if `str` starts with `prefix`, and `false` otherwise.

## Signature

```
startswith(str string, prefix string) bool
```

## Example

Run the full staging pipeline only when the branch is a feature branch:

```hcl theme={null}
variable "branch" {
  description = "Current git branch"
  type        = string
}

task "deploy-preview" {
  description = "Deploy a preview environment for feature branches"
  condition   = startswith(var.branch, "feature/")
  commands = [
    "docker build -t myapp:preview-${replace(var.branch, "/", "-")} .",
    "kubectl apply -f k8s/preview/",
  ]
}
```

The task runs only when `branch` starts with `feature/`.

## Notes

* The comparison is case-sensitive. Use [`lower`](/functions/string/lower) on both arguments for a case-insensitive check.
* Returns `false` when `prefix` is longer than `str`.
