HTML and CSS Reference
Table 9.10 Methods for String Manipulation (continued)
What It Does
Searches for the regular expression and returns the index
of where it was found.
Returns string containing the part of the string from
startpos to endpos.
Splits a string into an array of words based on delimiter.
Returns a subset of string starting at startpos up to, but
not including, endpos.
Returns a copy of the string converted to lowercase.
Returns a copy of the string converted to uppercase.
Converts all characters in a string to lowercase letters.
Returns the same string as the source string.
Converts all characters in a string to uppercase letters.
Returns the string value of the object.
Methods That Find a Position in a String. A substring is a piece of an already
existing string; thus eat is a substring of both create and upbeat , and Java is a substring
provides a number of methods to assist you in finding substrings.
The indexOf() and the lastIndexOf() methods are used to find the first instance or the
last instance of a substring within a larger string. They are both case sensitive. The first
character in a string is at index value 0, just like array indexes. If either of the methods
finds the substring, it returns the position of the first letter in the substring. If either
method can't find the pattern in the string, then a -1 is returned.
Searching for an @ sign
var email_addr=prompt("What is your email address? ","");