@Test public void testGetBetween() { Assert.assertEquals(TStringUtil.getBetween("wx[ b ]yz", "[", "]"), "b"); Assert.assertEquals(TStringUtil.getBetween(null, "a", "a"), null); Assert.assertEquals(TStringUtil.getBetween("abc", null, "a"), null); Assert.assertEquals(TStringUtil.getBetween("abc", "a", null), null); Assert.assertEquals(TStringUtil.getBetween("", "", ""), ""); Assert.assertEquals(TStringUtil.getBetween("", "", "]"), null); Assert.assertEquals(TStringUtil.getBetween("", "[", "]"), null); Assert.assertEquals(TStringUtil.getBetween("yabcz", "", ""), ""); Assert.assertEquals(TStringUtil.getBetween("yabcz", "y", "z"), "abc"); Assert.assertEquals(TStringUtil.getBetween("yabczyabcz", "y", "z"), "abc"); }
public static String getBetween(String sql, String start, String end) { if (sql == null || start == null || end == null) { return null; } int index0 = sql.indexOf(start); if (index0 == -1) { return null; } int index1 = sql.indexOf(end, index0); if (index1 == -1) { return null; } return sql.substring(index0 + start.length(), index1).trim(); }
TStringUtil extends StringUtils { public static String getBetween(String sql, String start, String end) { if (sql == null || start == null || end == null) { return null; } int index0 = sql.indexOf(start); if (index0 == -1) { return null; } int index1 = sql.indexOf(end, index0); if (index1 == -1) { return null; } return sql.substring(index0 + start.length(), index1).trim(); } }
TStringUtil extends StringUtils { public static String getBetween(String sql, String start, String end) { if (sql == null || start == null || end == null) { return null; } int index0 = sql.indexOf(start); if (index0 == -1) { return null; } int index1 = sql.indexOf(end, index0); if (index1 == -1) { return null; } return sql.substring(index0 + start.length(), index1).trim(); }  }
TStringUtil extends StringUtils { public static String getBetween(String sql, String start, String end) { if (sql == null || start == null || end == null) { return null; } int index0 = sql.indexOf(start); if (index0 == -1) { return null; } int index1 = sql.indexOf(end, index0); if (index1 == -1) { return null; } return sql.substring(index0 + start.length(), index1).trim(); }  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); }
TStringUtil extends StringUtils { public static String getBetween(String sql, String start, String end) { if (sql == null || start == null || end == null) { return null; } int index0 = sql.indexOf(start); if (index0 == -1) { return null; } int index1 = sql.indexOf(end, index0); if (index1 == -1) { return null; } return sql.substring(index0 + start.length(), index1).trim(); }  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);  }