contents   index   previous   next



String split()

syntax:

string.split([delimiterString])

where:

delimiterString - character, string or regular expression where the string is split. If substring is not specified, an array will be returned with the name of the string specified. Essentially this will mean that the string is split character by character.

 

return:

object - if no delimiters are specified, returns an array with one element which is the original string.

 

description:

This method splits a string into an array of strings based on the delimiters in the parameter delimiterString. The parameter delimiterString is optional and if supplied, determines where the string is split.

 

see:

Array join()

 

example:

/*

For example, to create an array of all

of the words in a sentence, use code similar

to the following fragment:

*/

 

var sentence = "I am not a crook";

var wordArray = sentence.split(' ');

 


String substr()