@Test public void mixed() { assertEquals(Arrays.asList("'s g'", "s' ", "\"s", "s\""), QuotedStringSplitter.split("\"'s g'\" \"s' \" '\"s' 's\"'")); }
public static List<String> split(String str) { Matcher m = pattern.matcher(str); List<String> result = new ArrayList<>(); while (m.find()) { String r; if (m.group(1) != null) { r = m.group(1); } else if (m.group(3) != null) { r = m.group(3); } else { r = m.group(); } result.add(StringEscapeUtils.unescapeJava(r)); } return result; }
QuotedStringSplitter { public static List<String> split(String str) { Matcher m = pattern.matcher(str); List<String> result = new ArrayList<>(); while (m.find()) { String r; if (m.group(1) != null) { r = m.group(1); } else if (m.group(3) != null) { r = m.group(3); } else { r = m.group(); } result.add(StringEscapeUtils.unescapeJava(r)); } return result; } }
QuotedStringSplitter { public static List<String> split(String str) { Matcher m = pattern.matcher(str); List<String> result = new ArrayList<>(); while (m.find()) { String r; if (m.group(1) != null) { r = m.group(1); } else if (m.group(3) != null) { r = m.group(3); } else { r = m.group(); } result.add(StringEscapeUtils.unescapeJava(r)); } return result; }  }
QuotedStringSplitter { public static List<String> split(String str) { Matcher m = pattern.matcher(str); List<String> result = new ArrayList<>(); while (m.find()) { String r; if (m.group(1) != null) { r = m.group(1); } else if (m.group(3) != null) { r = m.group(3); } else { r = m.group(); } result.add(StringEscapeUtils.unescapeJava(r)); } return result; }  static List<String> split(String str); }
QuotedStringSplitter { public static List<String> split(String str) { Matcher m = pattern.matcher(str); List<String> result = new ArrayList<>(); while (m.find()) { String r; if (m.group(1) != null) { r = m.group(1); } else if (m.group(3) != null) { r = m.group(3); } else { r = m.group(); } result.add(StringEscapeUtils.unescapeJava(r)); } return result; }  static List<String> split(String str);  }