• Returns the split array of the given string by the given delimiter

    Parameters

    • Optionaltext: null | string

      the source string to inspect

    • delimiter: string = ','

      the delimiter to split strings, defaults to comma

    • max: number = -1

      the max elements expected, negative means unlimited, defaults to -1

    • trim: boolean = true

      whether trim each element before returning, defaults to true

    Returns string[] | undefined

    the split array of the given string by the given delimiter

    split('foo,bar');    // ['foo', 'bar']
    split('hello | world | wonderful', '|', 2); // ['hello', 'world']