github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/functions/split.html.md (about) 1 --- 2 layout: "language" 3 page_title: "split - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-string-split" 5 description: |- 6 The split function produces a list by dividing a given string at all 7 occurrences of a given separator. 8 --- 9 10 # `split` Function 11 12 `split` produces a list by dividing a given string at all occurrences of a 13 given separator. 14 15 ```hcl 16 split(separator, string) 17 ``` 18 19 ## Examples 20 21 ``` 22 > split(",", "foo,bar,baz") 23 [ 24 "foo", 25 "bar", 26 "baz", 27 ] 28 > split(",", "foo") 29 [ 30 "foo", 31 ] 32 > split(",", "") 33 [ 34 "", 35 ] 36 ``` 37 38 ## Related Functions 39 40 * [`join`](./join.html) performs the opposite operation: producing a string 41 joining together a list of strings with a given separator.