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.
packer/website/pages/docs/from-1.5/functions/string/split.mdx

42 lines
709 B

---
layout: docs
page_title: split - Functions - Configuration Language
sidebar_title: 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
```shell-session
> split(",", "foo,bar,baz")
[
"foo",
"bar",
"baz",
]
> split(",", "foo")
[
"foo",
]
> split(",", "")
[
"",
]
```
## Related Functions
- [`join`](/docs/from-1.5/functions/string/join) performs the opposite operation: producing a string
joining together a list of strings with a given separator.