TStringUtil extends StringUtils { public static String[] twoPartSplit(String str, String splitor) { if (str != null && splitor != null) { int index = str.indexOf(splitor); if (index != -1) { String first = str.substring(0, index); String sec = str.substring(index + splitor.length()); return new String[] { first, sec }; } else { return new String[] { str }; } } else { return new String[] { str }; } }  static String getBetween(String sql, String start, String end); static String removeBetween(String sql, String start, String end); static String[] twoPartSplit(String str, String splitor); static List<String> recursiveSplit(String str, String splitor); static String fillTabWithSpace(String str); static boolean startsWithIgnoreCaseAndWs(String searchIn, String searchFor); static boolean startsWithIgnoreCaseAndWs(String searchIn, String searchFor, int beginPos); static boolean startsWithIgnoreCase(String searchIn, int startAt, String searchFor); static String stripComments(String src, String stringOpens, String stringCloses, boolean slashStarComments,
                                       boolean slashSlashComments, boolean hashComments, boolean dashDashComments); static String removeBetweenWithSplitor(String sql, String start, String end); static String removeBetweenWithSplitorNotExistNull(String sql, String start, String end); static boolean isTableFatherAndSon(String fatherTable, String sonTable);  }
@Test public void testTwoPartSplit() { Assert.assertArrayEquals(TStringUtil.twoPartSplit("abc:bc:bc", ":"), new String[] { "abc", "bc:bc" }); Assert.assertArrayEquals(TStringUtil.twoPartSplit(null, "a"), new String[] { null }); Assert.assertArrayEquals(TStringUtil.twoPartSplit("abc:bc", "d"), new String[] { "abc:bc" }); Assert.assertArrayEquals(TStringUtil.twoPartSplit("abc:bc", ";"), new String[] { "abc:bc" }); }