MCPcopy Create free account
hub / github.com/antlr/codebuff / trimTrailingFrom

Method trimTrailingFrom

output/java_guava/1.4.17/CharMatcher.java:963–971  ·  view source on GitHub ↗

Returns a substring of the input character sequence that omits all characters this matcher matches from the end of the string. For example: CharMatcher.anyOf("ab").trimTrailingFrom("abacatbab") ... returns "abacat".

(CharSequence sequence)

Source from the content-addressed store, hash-verified

961
962
963 public String trimTrailingFrom(CharSequence sequence) {
964 int len = sequence.length();
965 for (int last = len - 1; last >= 0; last--) {
966 if (!matches(sequence.charAt(last))) {
967 return sequence.subSequence(0, last + 1).toString();
968 }
969 }
970 return "";
971 }
972
973 /**
974 * Returns a string copy of the input character sequence, with each group of consecutive

Callers 4

decodeCheckedMethod · 0.45
canDecodeMethod · 0.45
decodeToMethod · 0.45
decodeToMethod · 0.45

Calls 3

matchesMethod · 0.95
toStringMethod · 0.65
lengthMethod · 0.45

Tested by

no test coverage detected