Use substring () or slice ()
function : Split ()
function : use a specified separator to split a string and store it to an array
example:
STR =" JPG | BMP | GIF | ICO | PNG ";
arr = thestring. split ("|");
// arr is an array containing character values" jpg "," BMP "," GIF "," ICO ", and" PNG "
function : John ()
function : use the separator you selected to combine an array into a string
example:
var delimitedstring = myarray. join (delimiter);
var mylist = new array ("jpg", "BMP", "GIF ", "ICO", "PNG");
var portablelist = mylist. join ("|");
// The result is JPG | BMP | GIF | ICO | PNG
Function: Substring ()
Function: String truncation. For example, substring () is used to obtain "minidx" from "minidxsearchengine)
function : indexof ()
function : returns the subscript of the first character matching the substring in the string
var mystring = "JavaScript ";
var W = mystring. indexof ("v"); W will be 2
var x = mystring. indexof ("s"); X will be 4
var y = mystring. indexof ("script"); y will also be 4
VaR z = mystring. indexof ("key"); Z will be-1