Files
nomad/website/content/docs/job-specification/hcl2/functions/string/split.mdx
Ashlee M Boyer 3444ece549 docs: Migrate link formats (#15779)
* Adding check-legacy-links-format workflow

* Adding test-link-rewrites workflow

* chore: updates link checker workflow hash

* Migrating links to new format

Co-authored-by: Kendall Strautman <kendallstrautman@gmail.com>
2023-01-25 09:31:14 -08:00

41 lines
708 B
Plaintext

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