Using the String Object : String : Language Basics JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Language Basics » String »

 

Using the String Object



<HTML>
<HEAD>
<TITLE>Using the String Object Type</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript"><!--
function displayLine(text) {
 document.write(text+"<BR>")
}
s = new String("abcdefghijklmnopqrstuvwasdfasdfasdfasdfasdf")
displayLine('s '+s)
displayLine('s.charAt(1'+s.charAt(1))
displayLine('s.charCodeAt(1'+s.charCodeAt(1))
displayLine('s.indexOf("is"'+s.indexOf("is"))
displayLine('s.lastIndexOf("is"'+s.lastIndexOf("is"))
displayLine('s.substring(22,32'+s.substring(22,32))
displayLine('s.toLowerCase() '+s.toLowerCase())
displayLine('s.toUpperCase() '+s.toUpperCase())
split = s.split(" ")
for(i=0; i<split.length; ++i)
 displayLine('split['+i+'] '+split[i])
// --></SCRIPT>
</BODY>
</HTML>
           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Language Basics
» String