split(str, [delim])

The split() function breaks a string into pieces using a character or string as the divider. The delim parameter specifies the character or characters that mark the boundaries between each piece. An array of strings is returned that contains each of the pieces.

The splitTokens() function works in a similar fashion, except that it splits using a range of characters instead of a specific character or sequence.

Type: function

Parameter(s):

  • str {String}:

    the String to be split

  • delim {String} Optional:

    The string used to separate the data

Returns:

  • {Array}:

    Array of strings