The string value to be split into substrings.
The pattern describing where each split should occur. Can be undefined, a
string, or an object with a Symbol.split
method (if supported) — the typical example being a regular expression. Omitting separator or
passing undefined causes strSplit() to return an array with the calling string as a single
element. All values that are not undefined or objects with a @@split
method are coerced to strings.
Optional
limit: numberA non-negative integer specifying a limit on the number of substrings to be included in the array. If provided, splits the string at each occurrence of the specified separator, but stops when limit entries have been placed in the array. Any leftover text is not included in the array at all.
An Array of strings, split at each point where the separator occurs in the given string.
The
strSplit()
splits a string into substrings using the pattern and divides a String into an ordered list of substrings by searching for the pattern, puts these substrings into an array, and returns the array.Since
0.9.1
Example