List<String> (@NotNull String text) { final List<String> result = new ArrayList<>(); final StringBuilder sb = new StringBuilder(); for (String line : StringUtil.splitByLines(text)) { if (line.endsWith("\\") && !line.endsWith("\\\\")) { sb.append(line, 0, line.length() - 1); } else { if (sb.length() == 0) { result.add(line); } else { sb.append(line); result.add(sb.toString()); sb.setLength(0); } } } return result; }