// does not return unclosed strings static L findSubstringsEnclosedBy_inner(S s, char a, char b) { int i = 0; new L l; while ((i = indexOf(s, a, i)) >= 0) { int j = indexOf(s, b, i+1); if (j < 0) break; l.add(substring(s, i+1, j)); i = j+1; } ret l; }