split

Return a new string in which all case-based characters are in lower case.

This function does not generate an event.

Function

str.split([separator], [limit])

Arguments

Argument Type Description
separator str (optional) The string used to split the original string. If omitted, white-space will be used as separator.
limit int (optional) Split at most limit times. If this value is negative, splitting starts from the end of the string. If omitted, no limit is used.

Return value

Returns a new list with substrings.

Examples

Example using split() without arguments:

'How are you doing?'.split();

Return value in JSON format

[
    "How",
    "are",
    "you",
    "doing?"
]

Example using split() with a limit:

'This is a test'.split(1);

Return value in JSON format

[
    "This",
    "is a test"
]

Example using split() with a negative limit:

'This is a test'.split(-1);

Return value in JSON format

[
    "This is a",
    "test"
]

Example using split() with a separator:

'title,subject,body'.split(',');

Return value in JSON format

[
    "title",
    "subject",
    "body"
]