Navigator 2.0, Internet Explorer 3.0
string.lastIndexOf(substring) string.lastIndexOf(substring, start)
The substring that is to be searched for within string.
An optional integer argument that specifies the position within string at which the search is to start. Legal values are 0 (the position of the first character in the string) to string.length-1 (the position of the last character in the string). If this argument is omitted, then the search begins at the last character of the string.
The position of the last occurrence of substring within string that appears before the start position, if any, or -1 if no such occurrence is found within string.
String.lastIndexOf() searches the string from end to beginning to see if it contains an occurrence of substring. The search begins at position start within string, or at the end of string if start is not specified. If an occurrence of substring is found, then String.lastIndexOf() returns the position of the first character of that occurrence. Since this method searches from end to beginning of the string, the first occurrence found will be the last one in the string that occurs before the start position.
If no occurrence of substring is found, then String.lastIndexOf() returns -1.
Note that although String.lastIndexOf() searches string from end to beginning, it still numbers character positions within string from the beginning. The first character of the string has position 0, and the last has position string.length-1.
file: /Techref/language/java/script/definitive/refp_365.htm, 6KB, , updated: 2019/10/14 15:00, local time: 2024/11/30 04:16,
18.119.162.226:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/Techref/language/java/script/definitive/refp_365.htm"> [Chapter 21] Reference: String.lastIndexOf()</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.