Returns a char matcher that matches any character present in the given character sequence.
(final CharSequence sequence)
| 438 | |
| 439 | |
| 440 | public static CharMatcher anyOf(final CharSequence sequence) { |
| 441 | switch (sequence.length()) { |
| 442 | case 0: |
| 443 | return none(); |
| 444 | case 1: |
| 445 | return is(sequence.charAt(0)); |
| 446 | case 2: |
| 447 | return isEither(sequence.charAt(0), sequence.charAt(1)); |
| 448 | default: |
| 449 | // TODO(lowasser): is it potentially worth just going ahead and building a precomputed |
| 450 | // matcher? |
| 451 | return new AnyOf(sequence); |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | /** |
| 456 | * Returns a {@code char} matcher that matches any character not present in the given character |
no test coverage detected