@Test public void testSplit_01() { String delim = "[^]"; String s = null; String[] chunks = StringUtil.split(s, delim); assertNull(chunks); s = "abc" + delim; chunks = StringUtil.split(s, delim); assertEquals("01", 1, chunks.length); assertEquals("02", "abc", chunks[0]); s = "abc" + delim + "def"; chunks = StringUtil.split(s, delim); assertEquals("03", 2, chunks.length); assertEquals("04", "abc", chunks[0]); assertEquals("05", "def", chunks[1]); s = "abc" + delim + "def" + delim; chunks = StringUtil.split(s, delim); assertEquals("06", 2, chunks.length); assertEquals("07", "abc", chunks[0]); assertEquals("08", "def", chunks[1]); s = "abc" + delim + "def" + delim + "g"; chunks = StringUtil.split(s, delim); assertEquals("09", 3, chunks.length); assertEquals("10", "abc", chunks[0]); assertEquals("11", "def", chunks[1]); assertEquals("12", "g", chunks[2]); s = delim; chunks = StringUtil.split(s, delim); assertEquals("13", 1, chunks.length); s = delim + "abc"; chunks = StringUtil.split(s, delim); assertEquals("14", 2, chunks.length); assertEquals("15", "", chunks[0]); assertEquals("16", "abc", chunks[1]); s = delim + delim + delim; chunks = StringUtil.split(s, delim); assertEquals("17", 3, chunks.length); assertEquals("18", "", chunks[0]); assertEquals("19", "", chunks[1]); assertEquals("20", "", chunks[2]); }
public static String[] split(String s, String delim) { return split(s, delim, 8); }
StringUtil { public static String[] split(String s, String delim) { return split(s, delim, 8); } }
StringUtil { public static String[] split(String s, String delim) { return split(s, delim, 8); }  }
StringUtil { public static String[] split(String s, String delim) { return split(s, delim, 8); }  static String substr(String string, int from); static String substr(String string, int from, int length); static String zpad(Object obj, int width, String separator); static String zpad(Object obj, int width); static String lpad(Object obj, int width, String separator); static String pad(Object obj, int width); static String pad(Object obj, int width, char padChar); static String pad(Object obj, int width, char padChar, String separator); static String lpad(Object obj, int width); static String lpad(Object obj, int width, char padChar); static String lpad(Object obj, int width, char padChar, String separator); static String rpad(Object obj, int width, String separator); static String rpad(Object obj, int width); static String rpad(Object obj, int width, char padChar); static String rpad(Object obj, int width, char padChar, String separator); static String substring(String string, int from, int to); static String toString(byte[] bytes); static String lchop(String string, String word); static String rchop(String string, String word); static String[] split(String s, String delim); static String[] split(String s, String delim, int numParts); static String trim(String s, char c); static String ltrim(String s, char c); static String trim(String s, char... chars); static String trim(String s, String chars); static String rtrim(String s, char c); static boolean isTrue(String s); static boolean isTrue(String s, boolean dfault); static String getResourceAsString(String path); static InputStream toInputStream(String s); static InputStream toInputStream(String s, String charset); static String fromInputStream(InputStream is); static String fromInputStream(InputStream is, String charset); static String fromInputStream(InputStream is, String charset, int bufsize); static int toInt(String s); static String emptyIfNull(String str); }
StringUtil { public static String[] split(String s, String delim) { return split(s, delim, 8); }  static String substr(String string, int from); static String substr(String string, int from, int length); static String zpad(Object obj, int width, String separator); static String zpad(Object obj, int width); static String lpad(Object obj, int width, String separator); static String pad(Object obj, int width); static String pad(Object obj, int width, char padChar); static String pad(Object obj, int width, char padChar, String separator); static String lpad(Object obj, int width); static String lpad(Object obj, int width, char padChar); static String lpad(Object obj, int width, char padChar, String separator); static String rpad(Object obj, int width, String separator); static String rpad(Object obj, int width); static String rpad(Object obj, int width, char padChar); static String rpad(Object obj, int width, char padChar, String separator); static String substring(String string, int from, int to); static String toString(byte[] bytes); static String lchop(String string, String word); static String rchop(String string, String word); static String[] split(String s, String delim); static String[] split(String s, String delim, int numParts); static String trim(String s, char c); static String ltrim(String s, char c); static String trim(String s, char... chars); static String trim(String s, String chars); static String rtrim(String s, char c); static boolean isTrue(String s); static boolean isTrue(String s, boolean dfault); static String getResourceAsString(String path); static InputStream toInputStream(String s); static InputStream toInputStream(String s, String charset); static String fromInputStream(InputStream is); static String fromInputStream(InputStream is, String charset); static String fromInputStream(InputStream is, String charset, int bufsize); static int toInt(String s); static String emptyIfNull(String str); static final String EMPTY; }