@split(s:string)
@split(s:string, sep:string)
@split(s:string, seps:tab)
You can specify the separator, default separator is any space
characters (those include "\n" (carriage return, "\t" (tabulation), " "
(whitespace) and any locale white-space characters as defiend by isspace
).
If the separator is specified by a string, this entire substring is taken as a separator.
If the separator is a tab, each element of this tab are a possible separator.
The result is a tab of strings. The elements of the tab are substrings of the string argument separated by the separator(s) (or the end of the string). An empty substrintg appears in the result if there is two consecutive separators in the argument.
Here are some examples:
//default separator
@split("abc def ghi") ⇒ ["abc", "def", "", "", "ghi"]
@split("abc\ndef ghi") ⇒ ["abc", "def", "", "", "ghi"] ==
@split("abc\tdef ghi") ⇒ ["abc", "def", "", "", "ghi"] ==
@split("abc def ghi ") ⇒ ["abc", "def", "", "", "ghi", ""]
// one explicit separator (a white space)
@split("abc def ghi", " ") ⇒ ["abc", "def", "", "", "ghi"]
@split("abc\ndef ghi", " ") ⇒ ["abc\ndef", "", "", "ghi"]
@split("abc\tdef ghi", " " )⇒ ["abc\tdef", "", "", "ghi"]
// multi-characters separator (coma followed by a white space)
@split("abc, def, , , ghi", ", ") ⇒ ["abc", "def", "", "", "ghi"]
@split("abc, def, , , ghi,", ", ") ⇒ ["abc", "def", "", "", "ghi,"]
@split("abc, def, , , ghi, ", ", ") ⇒ ["abc", "def", "", "", "ghi", ""]
// multiple separators
⇒["abc", "def", "", "", "ghi"] == @split("abc def ghi", [" ", ",", "\n", "\t"])
⇒["abc", "def", "", "", "ghi"] == @split("abc\ndef ghi", [" ", ",", "\n", "\t"])
⇒["abc", "def", "", "", "ghi"] == @split("abc\tdef ghi", [" ", ",", "\n", "\t"])
⇒["abc", "def", "", "", "ghi", ""] == @split("abc def ghi ", [" ", ",", "\n", "\t"])
See also Tab Manipulations @binary_search @car @cdr @clear [@clone] @concat @cons @copy @count @dim @domain @drop @empty @find @flatten @gnuplot @insert @iota @is_list @is_prefix @is_subsequence @is_suffix @lace @last @listify @map @max_val @median @member @normalize @occurs @parse @permute @push_back @push_front @range @reduce @remove @remove_duplicate @replace @reshape @resize @reverse @rotate @scan @scramble @size @slice @sort @sputter @stutter @succession @tab_history @tab_history_date @tab_history_rdate @take @to_num
See also Map (aka dictionnary) @add_pair @clear [@clone] @count @domain @find @gshift_map @insert @is_defined @is_function @is_map @listify @make_duration_map @make_label_bpm @make_label_duration @make_label_pitches @make_label_pos @make_score_map @map @map_compose @map_concat @map_history @map_history_date @map_history_rdate @map_normalize @map_reverse @mapval @max_key @max_val @member @merge @min_key @min_val @occurs @range @remove @select_map @shift_map