799 |
*/ |
*/ |
800 |
public int indexOf(String str, int fromIndex) throws NullPointerException { |
public int indexOf(String str, int fromIndex) throws NullPointerException { |
801 |
if (fromIndex < 0) fromIndex = 0; |
if (fromIndex < 0) fromIndex = 0; |
802 |
for (int i = fromIndex; i < count; i++) |
for (int i = fromIndex; i <= count; i++) |
803 |
if (regionMatches(i, str, 0, str.count)) |
if (regionMatches(i, str, 0, str.count)) |
804 |
return i; |
return i; |
805 |
return -1; |
return -1; |
846 |
* @exception NullPointerException if `str' is null |
* @exception NullPointerException if `str' is null |
847 |
*/ |
*/ |
848 |
public int lastIndexOf(String str) throws NullPointerException { |
public int lastIndexOf(String str) throws NullPointerException { |
849 |
return lastIndexOf(str, count-1); |
return lastIndexOf(str, count-str.count); |
850 |
} |
} |
851 |
|
|
852 |
/** |
/** |
864 |
*/ |
*/ |
865 |
public int lastIndexOf(String str, int fromIndex) |
public int lastIndexOf(String str, int fromIndex) |
866 |
throws NullPointerException { |
throws NullPointerException { |
867 |
if (fromIndex > count) |
if (fromIndex >= count) |
868 |
fromIndex = count; |
fromIndex = count - str.count; |
869 |
for (int i = fromIndex; i >= 0; i--) |
for (int i = fromIndex; i >= 0; i--) |
870 |
if (regionMatches(i, str, 0, str.count)) |
if (regionMatches(i, str, 0, str.count)) |
871 |
return i; |
return i; |