Strings { public static String[] split(String text, char delimiter) { List<String> tokens = Lists.newArrayList(); int start = 0; while (true) { int next = text.indexOf(delimiter, start); if (next == -1) break; tokens.add(text.substring(start, next)); start = next + 1; } if (start == 0) return new String[]{text}; else tokens.add(text.substring(start)); return tokens.toArray(new String[0]); }  static byte[] bytes(String text); static String format(String pattern, Object... params); static int compare(@Nullable String text1, @Nullable String text2); static boolean isBlank(@Nullable String text); static boolean equals(@Nullable String text1, @Nullable String text2); @Nullable static String truncate(@Nullable String text, int maxLength); @Nullable static String strip(@Nullable String text); static boolean startsWith(String text, char prefix); static String[] split(String text, char delimiter);  }
@Test void split() { assertThat(Strings.split("", '/')).containsExactly(""); assertThat(Strings.split("/", '/')).containsExactly("", ""); assertThat(Strings.split(" assertThat(Strings.split("/1", '/')).containsExactly("", "1"); assertThat(Strings.split("/1/", '/')).containsExactly("", "1", ""); assertThat(Strings.split("1/", '/')).containsExactly("1", ""); assertThat(Strings.split("1/2", '/')).containsExactly("1", "2"); assertThat(Strings.split("1/2 assertThat(Strings.split("1/2/3", '/')).containsExactly("1", "2", "3"); }