August 1999
Intermediate to advanced
1488 pages
72h 53m
English
string.charAt(num)
The charAt() method of an instance of the String object returns the character located at the indexed, num, position passed. This indexing is done from left to right starting with the 0 (zero) position. If the num passed is not a valid index in the string, –1 is returned.
Listing 6.233 creates an instance of a String object. When the page is loaded, the user is prompted for an index number. After entering the index number and clicking OK, the character at that indexed location is written to the document. Notice that there is also a check to see if the character at that location is a space.
Read now
Unlock full access