String Objects
Manipulating Strings
A string declared using var myString = 'string text' is implicitly a string
object, and you can still use string object methods such as myString.length
<script type="text/javascript">
var myText = prompt('Please enter a string to capture to a variable: ', '');
document.write("Type of input: " + typeof(myText) + "<br />Length of string: " +
myText.length + "<br />");
var myObj = new String(prompt('Please enter a string to store in a string object: ', ''));
document.write("Type of input: " + typeof(myObj) + "<br />Length of object: " +
myObj.length + "<br />");
var myEmail = "Bill.Gates@microsoft.com";
document.write('The @ character occurs at position ' + (myEmail.indexOf('@') + 1) +
' in the email address: ' + myEmail + "<br />");
document.write('The domain of that email address is: ' +
myEmail.substring(myEmail.indexOf('@')+1, myEmail.length) + "<br />");
document.write('Email address: ' + myEmail + ' and after toLowerCase ');
document.write(myEmail.toLowerCase( ) + "<br />");
</script>
