<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>
|