• This function mirrors the split function from the JavaScript Standard String object. It handles Unicode code points instead of UTF-16 character codes.

    Takes a pattern and divides the string into an ordered list of substrings by searching for the pattern, puts these substrings into an array, and returns the array.

    Parameters

    • string: string

      The string to split

    • separator: string | RegExp

      The pattern describing where each split should occur

    • OptionalsplitLimit: number

      Limit on the number of substrings to be included in the array. Splits the string at each occurrence of specified separator, but stops when limit entries have been placed in the array.

    Returns string[]

    An array of strings, split at each point where separator occurs in the starting string. Returns undefined if separator is not found in string.