$input.split(separator: ",", trim: true)
Splits an input string into a list of strings using a given separator. All occurrences of the separator string are searched for in the input string and the character strings between the separators are returned as a list.
| String name | Type | Type Description | Mandatory | Default |
|---|---|---|---|---|
input |
Character string | The character string to be split | Yes | |
separator |
String/regular expression | The separator to be used to split the input string. | no | "," |
trim |
Truth value | Whether to remove spaces at the beginning and end of the result entries. | no | true |
Type: List of character strings
The character strings between the separators found in the input string.
"a, b, c".split()
Output: ["a", "b", "c"]
The list of comma-separated words from the input.
"Hello world and hello moon!".split(" ")
Output: ["Hello", "world", "and", "hello", "moon!"]
The space-separated words from the input.
"a --- b - c -- d".split(regex("-+"))
Output: ["a", "b", "c", "d"]
The words in the input separated by any number of minus signs.
"a, b, c".split(trim:false)
Output: ["a", " b", " c"]
Exactly the character strings between the separators. There is a space before each of the characters b and c.