String.indexOf() should take an int, not a char

This commit is contained in:
Joel Dice 2007-08-18 15:22:43 -06:00
parent aa5e751e69
commit 77136e77cb

View File

@ -121,7 +121,7 @@ public final class String implements Comparable<String> {
} }
} }
public int indexOf(char c) { public int indexOf(int c) {
for (int i = 0; i < length - 1; ++i) { for (int i = 0; i < length - 1; ++i) {
if (charAt(i) == c) { if (charAt(i) == c) {
return i; return i;
@ -131,7 +131,7 @@ public final class String implements Comparable<String> {
return -1; return -1;
} }
public int lastIndexOf(char c) { public int lastIndexOf(int c) {
for (int i = length - 1; i >= 0; --i) { for (int i = length - 1; i >= 0; --i) {
if (charAt(i) == c) { if (charAt(i) == c) {
return i; return i;