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

Method finishCollapseFrom

output/java_guava/1.4.19/CharMatcher.java:1035–1055  ·  view source on GitHub ↗
(
    CharSequence sequence,
    int start,
    int end,
    char replacement,
    StringBuilder builder,
    boolean inMatchingGroup)

Source from the content-addressed store, hash-verified

1033 }
1034
1035 private String finishCollapseFrom(
1036 CharSequence sequence,
1037 int start,
1038 int end,
1039 char replacement,
1040 StringBuilder builder,
1041 boolean inMatchingGroup) {
1042 for (int i = start; i < end; i++) {
1043 char c = sequence.charAt(i);
1044 if (matches(c)) {
1045 if (!inMatchingGroup) {
1046 builder.append(replacement);
1047 inMatchingGroup = true;
1048 }
1049 } else {
1050 builder.append(c);
1051 inMatchingGroup = false;
1052 }
1053 }
1054 return builder.toString();
1055 }
1056
1057 /**
1058 * @deprecated Provided only to satisfy the {@link Predicate} interface; use {@link #matches}

Callers 2

collapseFromMethod · 0.95
trimAndCollapseFromMethod · 0.95

Calls 3

matchesMethod · 0.95
toStringMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected