Oops, experiment in progress. Back out last change.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@922910 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2010-03-14 17:42:08 +00:00
parent 5fe2d862fc
commit 7780fa0ad5
1 changed files with 0 additions and 35 deletions

View File

@ -83,39 +83,4 @@ public class CharSequenceUtils {
public static CharSequence subSequence(CharSequence cs, int start) { public static CharSequence subSequence(CharSequence cs, int start) {
return cs == null ? null : cs.subSequence(start, cs.length()); return cs == null ? null : cs.subSequence(start, cs.length());
} }
public static int indexOf(CharSequence cs, int ch, int startPos) {
int max = cs.length();
if (startPos < 0) {
startPos = 0;
} else if (startPos >= max) {
return StringUtils.INDEX_NOT_FOUND;
}
if (ch < Character.MIN_SUPPLEMENTARY_CODE_POINT) {
for (int i = startPos; i < max; i++) {
if (cs.charAt(i) == ch) {
return i;
}
}
return StringUtils.INDEX_NOT_FOUND;
}
// supp chars
if (ch <= Character.MAX_CODE_POINT) {
char[] surrogates = Character.toChars(ch);
for (int i = startPos; i < max; i++) {
if (cs.charAt(i) == surrogates[0]) {
if (i + 1 == max) {
break;
}
if (cs.charAt(i + 1) == surrogates[1]) {
return i;
}
}
}
}
return StringUtils.INDEX_NOT_FOUND;
}
} }