java 正则 替换中文为空

    //中文替换为""
    public String replaceChineseToNULL(String s){
        String reg = "[\u4e00-\u9fa5]";
        Pattern pat = Pattern.compile(reg);
        Matcher m=pat.matcher(s);
        return m.replaceAll("");
    }

  这样调用方法传递一个串会自动将串内中文替换为空 ""

posted @ 2017-07-14 10:33  蓝色枫梦  阅读(2425)  评论(0编辑  收藏  举报