sS joinLinesWithBarOrPunctuation(S text) { LS lines = tlft(text); new StringBuilder buf; S sep = ""; for (S s : lines) { buf.append(sep).append(s); if (endsWithPunctuation(s)) sep = " "; else sep = " | "; } ret str(buf); }