获取指定字符串出现的次数

来源:互联网 发布:淘宝马切达工作室 编辑:程序博客网 时间:2024/04/28 15:27
ublic static int findStr2(String srcText, String keyword) {        int count = 0;        Pattern p = Pattern.compile(keyword);        Matcher m = p.matcher(srcText);        while (m.find()) {            count++;        }        return count;}  

0 0
原创粉丝点击