var Val = new String("my name is xyz")
var Val1 = new String("my name is abc")
var Val2 = new String("my name is lmn")
var Val3 = Val1.concat(Val2)//Combines the text of two strings and returns a new string.
var Val4 = Val2.indexOf("is")//Returns the index within the calling String object of the first occurrence of the specified value, or -1 if not found.
var Val5 = Val2.lastIndexOf("lmn")//Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found.
var Val6 = Val2.localeCompare( "XYZ" );//Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order.
var re = ("is lmn")
var found = Val2.match( re );//Used to match a regular expression against a string.
var re1 = ("xyz")
var re2 = ("xyz")
var stringtoadd = Val.replace(re1,"megha");//Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring.
var found1 = Val2.split( " ",4 );
//document.write("Introduction : " + Val + "</br>")
//document.write(Val.charAt(1) + "</br>");//charAt()Returns the character at the specified index.
//document.write(Val.charCodeAt(3) + "</br>");//Returns a number indicating the Unicode value of the character at the given index.
//document.write(Val3 + "</br>");
//document.write(Val4 + "</br>");
//document.write(Val5 + "</br>");
//document.write(Val6 + "</br>");
//document.write(found+ "</br>");
//document.write(stringtoadd+ "</br>");
/*if (Val2.search (re2) == -1){
document.write("do not contain string")
} else {
document.write("contains string")
}//Executes the search for a match between a regular expression and a specified string.*/
//document.write(found1)
document.write("(1,2): " + Val2.substr(1,2));
document.write("<br />(-2,2): " + Val2.substr(-2,2));
document.write("<br />(1): " + Val2.substr(1));
document.write("<br />(-20, 2): " + Val2.substr(-20,2));
document.write("<br...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.