_.split

_.split([string=''], separator, [limit])

source npm package

Splits string by separator.

Note: This method is based on String#split.

Since

4.0.0

Arguments

  1. [string=''] (string): The string to split.
  2. separator (RegExp|string): The separator pattern to split by.
  3. [limit] (number): The length to truncate results to.

Returns

(Array): Returns the string segments.

Example

_.split('a-b-c', '-', 2);
// => ['a', 'b']