_.split

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

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']
doc_Lodash
2016-11-27 16:40:40
Comments
Leave a Comment

Please login to continue.