mirror of
https://github.com/corda/corda.git
synced 2025-01-21 03:55:00 +00:00
Adjust fromIndex in String#lastIndexOf if necessary
If fromIndex '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 the string': http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#lastIndexOf%28int,%20int%29 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
6f64e3aaab
commit
2ff0178da4
@ -602,6 +602,9 @@ public final class String
|
||||
}
|
||||
|
||||
public int lastIndexOf(int ch, int lastIndex) {
|
||||
if (lastIndex >= length) {
|
||||
lastIndex = length - 1;
|
||||
}
|
||||
for (int i = lastIndex ; i >= 0; --i) {
|
||||
if (charAt(i) == ch) {
|
||||
return i;
|
||||
|
Loading…
Reference in New Issue
Block a user