Files
opentf/website/docs/language/functions/split.mdx
Marcin Białoń 554f303899 Update website/docs/language/functions (#227)
Signed-off-by: Marcin Białoń <mbialon@spacelift.io>
2023-08-30 14:59:37 +02:00

40 lines
657 B
Plaintext

---
page_title: split - Functions - Configuration Language
description: |-
The split function produces a list by dividing a given string at all
occurrences of a given separator.
---
# `split` Function
`split` produces a list by dividing a given string at all occurrences of a
given separator.
```hcl
split(separator, string)
```
## Examples
```
> split(",", "foo,bar,baz")
[
"foo",
"bar",
"baz",
]
> split(",", "foo")
[
"foo",
]
> split(",", "")
[
"",
]
```
## Related Functions
* [`join`](/opentf/language/functions/join) performs the opposite operation: producing a string
joining together a list of strings with a given separator.