See also: parseString |
Splits a string into pieces delimited by a specific character and then creates an array with those pieces. If no delimiter is specified, the splitString function splits the string using a comma (',') as the delimiter.
JSV_splitString(expS [, delimiter])
expS.splitString([delimiter])
Returns an array of elements from a expS. If the delimiter does not exist in the string, then the string expS is returned as the element of a one-dimensional array.
The splitString function uses the following arguments.
Argument | Description |
expS | String being searched. |
delimiter | Optional. Single delimiter used in string. Default value is a comma. |
Unlike parseString
,
splitString
only separates the
delimited list based on one delimiter and does not provide the capability for the
programmer to retain the delimiters in the resulting array.
Deprecated. Use the split
method
of String
that splits a String
object into an array of strings by separating the string into substrings.
The following lines of code
var i = 0;
var delimitedString = "red,white,blue";
document.write( "The delimited string " +
delimitedString.bold() +
" contains the following elements:" );
var dsElements = JSV_splitString(delimitedString, ",");
for (i=0; i<dsElements.length; i++) {
document.write( "Element " + i + " is " + dsElements[i].bold() );
}
produce
Copyright © 1998-2000 Roaring Fork Software. All rights reserved.