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

Method finishCollapseFrom

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

Source from the content-addressed store, hash-verified

1037 }
1038
1039 private String finishCollapseFrom(
1040 CharSequence sequence,
1041 int start,
1042 int end,
1043 char replacement,
1044 StringBuilder builder,
1045 boolean inMatchingGroup) {
1046 for (int i = start; i < end; i++) {
1047 char c = sequence.charAt(i);
1048 if (matches(c)) {
1049 if (!inMatchingGroup) {
1050 builder.append(replacement);
1051 inMatchingGroup = true;
1052 }
1053 } else {
1054 builder.append(c);
1055 inMatchingGroup = false;
1056 }
1057 }
1058 return builder.toString();
1059 }
1060
1061 /**
1062 * @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