mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-20 10:19:27 -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>
40 lines
625 B
Plaintext
40 lines
625 B
Plaintext
---
|
|
sidebar_label: split
|
|
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`](../../language/functions/join.mdx) performs the opposite operation: producing a string
|
|
joining together a list of strings with a given separator.
|