code: public String trimTrailingFrom(CharSequence sequence) {
      int len = sequence.length();
      for (int last = len - 1; last >= 0; last--) {
        if (!matches(sequence.charAt(last))) {
          return sequence.subSequence(0, last + 1).toString();
        }
      }
      return "";
    }
docs: Returns a substring of the input character sequence that omits all matching BMP characters from
  the end of the string. For example:
  
  <pre>{@code
  CharMatcher.anyOf("ab").trimTrailingFrom("abacatbab")
  }</pre>
  
  ... returns {@code "abacat"}.