JS string interceptor function instance


Use substring() or slice()

Function: the split () Function: stores a string into an array using a specified delimiter Example:

str= " jpg|bmp|gif|ico|png " ;
arr=theString.split( " | " );
//Arr is an array of character values "JPG", "BMP", "GIF", "ico", and "PNG"

John () function: Function: combine an array into a string using the separator of your choice Example:

var delimitedString=myArray.join(delimiter);
var myList=new Array( " jpg " , " bmp " , " gif " , " ico " , " png " );
var portableList=myList.join( " | " );
//Result is JPG | BMP | | GIF ico | PNG

Function: the substring () Function: string interception, such as “Minidx” from “MinidxSearchEngine” to use substring(0,6)