Merge "Remove a useless function"

This commit is contained in:
Jean Chalard 2013-04-15 13:06:33 +00:00 committed by Android (Google) Code Review
commit b76ce1251e
2 changed files with 0 additions and 29 deletions

View file

@ -282,15 +282,4 @@ public final class StringUtils {
}
return builder.toString();
}
public static boolean containsAny(final String string, final String separators) {
final int len = separators.length();
for (int i = 0; i < len; i = separators.offsetByCodePoints(i, 1)) {
final int separator = separators.codePointAt(i);
if (-1 != string.indexOf(separator)) {
return true;
}
}
return false;
}
}

View file

@ -215,22 +215,4 @@ public class StringUtilsTests extends AndroidTestCase {
checkCapitalize("Lorem!Ipsum (dolor) Sit * Amet", "Lorem!Ipsum (Dolor) Sit * Amet",
" \n,.;!?*()&", Locale.ENGLISH);
}
public void testContainsAny() {
assertFalse(StringUtils.containsAny("", " "));
assertFalse(StringUtils.containsAny("test and retest", ""));
assertTrue(StringUtils.containsAny("test and retest", "x3iq o"));
assertTrue(StringUtils.containsAny("test and retest", "x3iqo "));
assertTrue(StringUtils.containsAny("test and retest", " x3iqo"));
assertFalse(StringUtils.containsAny("test and retest", "x3iqo"));
assertTrue(StringUtils.containsAny("test and retest", "tse "));
assertTrue(StringUtils.containsAny("test and retest.", ".?()"));
assertFalse(StringUtils.containsAny("test and retest", ".?()"));
// Surrogate pair
assertTrue(StringUtils.containsAny("test and \uD861\uDED7 retest.", "\uD861\uDED7"));
// Ill-formed string
assertFalse(StringUtils.containsAny("test and \uD861 retest.", "\uD861\uDED7"));
// Ill-formed string
assertFalse(StringUtils.containsAny("test and \uDED7 retest.", "\uD861\uDED7"));
}
}