@Test public void should_split_test_separated_by_commas() { String content = "file: final List<String> strings = Strings.splitAndTrimAsList(content, "\\s*,\\s*"); assertThat(strings) .containsExactly("file: }
public static List<String> splitAndTrimAsList(String text, String sep) { ArrayList<String> answer = new ArrayList<>(); if (text != null && text.length() > 0) { for (String v : text.split(sep)) { String trim = v.trim(); if (trim.length() > 0) { answer.add(trim); } } } return answer; }
Strings { public static List<String> splitAndTrimAsList(String text, String sep) { ArrayList<String> answer = new ArrayList<>(); if (text != null && text.length() > 0) { for (String v : text.split(sep)) { String trim = v.trim(); if (trim.length() > 0) { answer.add(trim); } } } return answer; } }
Strings { public static List<String> splitAndTrimAsList(String text, String sep) { ArrayList<String> answer = new ArrayList<>(); if (text != null && text.length() > 0) { for (String v : text.split(sep)) { String trim = v.trim(); if (trim.length() > 0) { answer.add(trim); } } } return answer; } private  Strings(); }
Strings { public static List<String> splitAndTrimAsList(String text, String sep) { ArrayList<String> answer = new ArrayList<>(); if (text != null && text.length() > 0) { for (String v : text.split(sep)) { String trim = v.trim(); if (trim.length() > 0) { answer.add(trim); } } } return answer; } private  Strings(); static boolean isNullOrEmpty(String s); static boolean isNotNullOrEmpty(String s); static String join(final Collection<?> collection, final String separator); static List<String> splitAsList(String text, String delimiter); static List<String> splitAndTrimAsList(String text, String sep); }
Strings { public static List<String> splitAndTrimAsList(String text, String sep) { ArrayList<String> answer = new ArrayList<>(); if (text != null && text.length() > 0) { for (String v : text.split(sep)) { String trim = v.trim(); if (trim.length() > 0) { answer.add(trim); } } } return answer; } private  Strings(); static boolean isNullOrEmpty(String s); static boolean isNotNullOrEmpty(String s); static String join(final Collection<?> collection, final String separator); static List<String> splitAsList(String text, String delimiter); static List<String> splitAndTrimAsList(String text, String sep);  }