java 截取替换掉括号 包括括号中的内容

    public static void main(String[] args) {
        String company = "华厦世纪(厦门)地产";
//        System.out.println(str.indexOf("司"));
//        System.out.println(str.substring(0,str.indexOf("代理有限公司")));
//        System.out.println(str.charAt(str.indexOf("有限公司")-1));
//        System.out.println(str.substring(2,str.length()));
//        System.out.println(str.substring(0,str.indexOf("有限公司")+4));
//        System.out.println(str.substring(str.indexOf("理")+1,str.length()));
//        System.out.println(company.replace("21", "").contains(("[0-9]")));
//        System.out.println(isContainNumber(company.replace("21", "")));
        System.out.println(ClearBracket(company));

public static String ClearBracket(String company){
        String bracket = company.substring(company.indexOf("("),company.indexOf(")")+1);
        company = company.replace(bracket, "");
        return company;
    }
结果:
华厦世纪地产
原文地址:https://www.cnblogs.com/tnsay/p/5818100.html