Returns a substring of the input character sequence that omits all characters this matcher matches from the beginning of the string. For example: CharMatcher.anyOf("ab").trimLeadingFrom("abacatbab") ... returns "catbab".
(CharSequence sequence)
| 942 | |
| 943 | |
| 944 | public String trimLeadingFrom(CharSequence sequence) { |
| 945 | int len = sequence.length(); |
| 946 | for (int first = 0; first < len; first++) { |
| 947 | if (!matches(sequence.charAt(first))) { |
| 948 | return sequence.subSequence(first, len).toString(); |
| 949 | } |
| 950 | } |
| 951 | return ""; |
| 952 | } |
| 953 | |
| 954 | /** |
| 955 | * Returns a substring of the input character sequence that omits all characters this matcher |