@Test public void split() { List<String> result = MoreStringUtil.split("192.168.0.1", '.', 4); assertThat(result).hasSize(4).containsSequence("192", "168", "0", "1"); result = MoreStringUtil.split("192.168..1", '.', 4); assertThat(result).hasSize(3).containsSequence("192", "168", "1"); result = MoreStringUtil.split("192.168.0.", '.', 4); assertThat(result).hasSize(3).containsSequence("192", "168", "0"); assertThat(MoreStringUtil.split(null, '.', 4)).isNull(); assertThat(MoreStringUtil.split("", '.', 4)).hasSize(0); Splitter splitter = MoreStringUtil.charsSplitter("/\\").omitEmptyStrings(); result = splitter.splitToList("/a/b/c"); assertThat(result).hasSize(3).containsSequence("a", "b", "c"); result = splitter.splitToList("\\a\\b\\c"); assertThat(result).hasSize(3).containsSequence("a", "b", "c"); }
public static List<String> split(@Nullable final String str, final char separatorChar) { return split(str, separatorChar, 10); }
MoreStringUtil { public static List<String> split(@Nullable final String str, final char separatorChar) { return split(str, separatorChar, 10); } }
MoreStringUtil { public static List<String> split(@Nullable final String str, final char separatorChar) { return split(str, separatorChar, 10); }  }
MoreStringUtil { public static List<String> split(@Nullable final String str, final char separatorChar) { return split(str, separatorChar, 10); }  static List<String> split(@Nullable final String str, final char separatorChar); static List<String> split(@Nullable final String str, final char separatorChar, int expectParts); static Splitter charsSplitter(final String separatorChars); static String replaceFirst(@Nullable String s, char sub, char with); static String replaceLast(@Nullable String s, char sub, char with); static boolean startWith(@Nullable CharSequence s, char c); static boolean endWith(@Nullable CharSequence s, char c); static String removeEnd(final String s, final char c); static int utf8EncodedLength(@Nullable CharSequence sequence); }
MoreStringUtil { public static List<String> split(@Nullable final String str, final char separatorChar) { return split(str, separatorChar, 10); }  static List<String> split(@Nullable final String str, final char separatorChar); static List<String> split(@Nullable final String str, final char separatorChar, int expectParts); static Splitter charsSplitter(final String separatorChars); static String replaceFirst(@Nullable String s, char sub, char with); static String replaceLast(@Nullable String s, char sub, char with); static boolean startWith(@Nullable CharSequence s, char c); static boolean endWith(@Nullable CharSequence s, char c); static String removeEnd(final String s, final char c); static int utf8EncodedLength(@Nullable CharSequence sequence);  }