August 1999
Intermediate to advanced
1488 pages
72h 53m
English
string.indexOf(string, num) string.indexOf(string)
The indexOf() method of an instance of the String object returns the indexed start position of the string passed. Additionally, you can specify an index, defined by num in the syntax definition, to start your search for the string specified. This method is the same as the String.lastIndexOf() method, but it starts at the beginning of the string.
Listing 6.240 creates a simple instance of the String object. This instance is then passed to the indexOf() method on two occasions with the result written to the user's page. The first occasion looks for a space in the string, which ...
Read now
Unlock full access