Java Script tutorial 13
split, replace, search.
var string1 = new String("Hello");
var string2 = "hi you are visiting dotnetlovers";
document.write("Split the string2 from 'are' so first part is : <b>" + string2.split('are') + "
</b>and second is : <b>" + string2.split('are') + "</b>.");
document.write("<br /><br />Replace 'H' to 'F' from string1: <b>" + string1.replace('H', 'F') + "</b>.");
document.write("<br /><br />Search position of 'are' from string2 <b>: " + string2.search('are') + "</b>.");
In above code we split the string2 by are using split method. the splited string can be
accessed using array type (E.g. , ). Second is replace method used for replace any character
or any word replace method have two arguments first is which you want to replace and second is the
by which want to replace. The third is search method which gives the char position of that substring.