Brace expansion: Difference between revisions

Content added Content deleted
(→‎{{header|Java}}: small changes)
Line 1,162:
 
private static void expandR(String pre, String s, String suf) {
int i1 = -1, i2 = 0;
String noEscape = s.replaceAll("([\\\\]{2}|[\\\\][,}{])", " ");
StringBuilder sb = null;
 
outer:
while ((i1 = noEscape.indexOf('{', i1 + 1);) != -1) {
do {
i1 = noEscape.indexOf('{', i1 + 1);
i2 = i1 + 1;
sb = new StringBuilder(s);
for (int depth = 1; i2 > 0 && i2 < s.length() && depth > 0; i2++) {
char c = noEscape.charAt(i2);
depth = (c == '{') ? ++depth : depth;
Line 1,180 ⟶ 1,179:
break outer;
}
} while (i1 != -1);
 
if (i1 == -1) {
if (suf.length() > 0)