split
stringSplits a string into an array using a separator
Syntax
split(string, separator) Parameters
string (string) The string to split
separator (string) The delimiter to split on
Returns
array Array of string segments
Examples
Input:
split("a,b,c", ",") Output:
["a", "b", "c"] Input:
split("hello world", " ") Output:
["hello", "world"] The split() function divides a string into an array of substrings using a specified separator. This is essential for parsing delimited data.
Usage
Use split() to parse CSV data, extract words from text, or break strings into processable chunks.