Split

From MiniScript Wiki
Jump to navigation Jump to search

split splits a string into a list, by some delimiter.

See also: join

Arguments

Parameter Name Default Value Meaning
self string string to split
delimiter string, default " " substring to split on
maxCount number, default -1 if > 0, split into no more than this many strings

Usage Notes

split may be called with function syntax or dot syntax.

Example

"foo bar baz".split		// returns ["foo", "bar", "baz"] 
"foo bar baz".split("a", 2)	// returns ["foo b", "r baz"]