BBjString::lastIndexOf
Description
In BBj 7.0 and higher, this
method returns the index within this string of the
last occurrence of the specified character. For values of ch in the range
from 0 to 0xFFFF (inclusive), the index (in Unicode code units) returned
is the largest value k such that: this.charAt(k)
== ch
is true. For other
values of ch, it is the largest value k such that: this.codePointAt(k) == ch
is
true. In either case, if no such character occurs in this string, then
-1 is returned. The String is searched backwards starting at the last
character.
Syntax
Return Value |
Method |
---|---|
int |
lastIndexOf(int ch) |
int |
lastIndexOf(int ch, int fromIndex) |
int |
lastIndexOf(string str) |
int |
lastIndexOf(string str, int fromIndex) |
Parameters
Variable |
Description |
---|---|
ch |
A character (Unicode code point). |
fromIndex |
The index to start the search from. There is no restriction on the value of fromIndex. If it is greater than or equal to the length of this string, it has the same effect as if it were equal to one less than the length of this string: this entire string may be searched. If it is negative, it has the same effect as if it were -1: -1 is returned. |
str |
The substring to search for. |
Return Value
Returns the index of the last occurrence of the character in the character sequence represented by this string, or -1 if the character does not occur.
Remarks
None.
Example
|
See Also
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.