@Test public void testSplitWithNonEmptyString() { String[] stringArray = StringSplitter.split("]sZ}gR\"cws,8p#|m", "Fc8!v~f?aQL"); assertEquals(1, stringArray.length); assertEquals("]sZ}gR\"cws,8p#|m", stringArray[0]); }
public static String[] split(String str, String delimiter) { List<String> list = new ArrayList<String>(); int index = 0, offset = 0; int l = delimiter.length(); if (str.startsWith(delimiter)) { list.add(""); offset = offset + l; } while ((index = str.indexOf(delimiter, index + 1)) != -1) { list.add(str.substring(offset, index)); offset = index + l; } list.add(str.substring(offset)); return list.toArray(new String[0]); }
StringSplitter { public static String[] split(String str, String delimiter) { List<String> list = new ArrayList<String>(); int index = 0, offset = 0; int l = delimiter.length(); if (str.startsWith(delimiter)) { list.add(""); offset = offset + l; } while ((index = str.indexOf(delimiter, index + 1)) != -1) { list.add(str.substring(offset, index)); offset = index + l; } list.add(str.substring(offset)); return list.toArray(new String[0]); } }
StringSplitter { public static String[] split(String str, String delimiter) { List<String> list = new ArrayList<String>(); int index = 0, offset = 0; int l = delimiter.length(); if (str.startsWith(delimiter)) { list.add(""); offset = offset + l; } while ((index = str.indexOf(delimiter, index + 1)) != -1) { list.add(str.substring(offset, index)); offset = index + l; } list.add(str.substring(offset)); return list.toArray(new String[0]); }  }
StringSplitter { public static String[] split(String str, String delimiter) { List<String> list = new ArrayList<String>(); int index = 0, offset = 0; int l = delimiter.length(); if (str.startsWith(delimiter)) { list.add(""); offset = offset + l; } while ((index = str.indexOf(delimiter, index + 1)) != -1) { list.add(str.substring(offset, index)); offset = index + l; } list.add(str.substring(offset)); return list.toArray(new String[0]); }  static String[] split(String str, String delimiter); }
StringSplitter { public static String[] split(String str, String delimiter) { List<String> list = new ArrayList<String>(); int index = 0, offset = 0; int l = delimiter.length(); if (str.startsWith(delimiter)) { list.add(""); offset = offset + l; } while ((index = str.indexOf(delimiter, index + 1)) != -1) { list.add(str.substring(offset, index)); offset = index + l; } list.add(str.substring(offset)); return list.toArray(new String[0]); }  static String[] split(String str, String delimiter);  }