am b76ce125: Merge "Remove a useless function"

* commit 'b76ce1251ee78067ebdc349ea94ea145d87488c4':
  Remove a useless function
main
Jean Chalard 2013-04-15 06:09:18 -07:00 committed by Android Git Automerger
commit 8e643e32e6
2 changed files with 0 additions and 29 deletions

View File

@ -282,15 +282,4 @@ public final class StringUtils {
} }
return builder.toString(); 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", checkCapitalize("Lorem!Ipsum (dolor) Sit * Amet", "Lorem!Ipsum (Dolor) Sit * Amet",
" \n,.;!?*()&", Locale.ENGLISH); " \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"));
}
} }