TStringUtil extends StringUtils { public static String removeBetween(String sql, String start, String end) { if (sql == null) { return null; } if (start == null || end == null) { return sql; } int index0 = sql.indexOf(start); if (index0 == -1) { return sql; } int index1 = sql.indexOf(end, index0); if (index1 == -1) { return sql; } StringBuilder sb = new StringBuilder(); sb.append(sql.substring(0, index0)); sb.append(" "); sb.append(sql.substring(index1 + end.length())); return sb.toString(); }  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 testRemoveBetween() { Assert.assertEquals(TStringUtil.removeBetween("abc[xxx]bc", "[", "]"), "abc bc"); }