List<String> (@NotNull String string) { int idx = string.indexOf(BEGIN_MARK); if (idx == -1) { return Collections.singletonList(string); } List<String> res = new ArrayList<>(); while (idx != -1) { int endIdx = string.indexOf(BEGIN_MARK, idx + BEGIN_MARK.length()); res.add(string.substring(idx, endIdx == -1 ? string.length() : endIdx)); idx = endIdx; } return res; }