Java Code Examples for org.apache.commons.lang3.math.NumberUtils.INTEGER_ZERO

The following are Jave code examples for showing how to use INTEGER_ZERO of the org.apache.commons.lang3.math.NumberUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: private-WeChat   File: ChineseUtil.java   View Source Code Vote up 5 votes
/**
 * 功能描述: 返回中文字个数<br>
 * .
 * 
 * @param chinese the chinese
 * @return the int
 */
public static int countChinese(String chinese) {
    if (StringUtils.isBlank(chinese)) {
        return NumberUtils.INTEGER_ZERO;
    }
    int count = NumberUtils.INTEGER_ZERO;
    String regEx = "[\\u4e00-\\u9fa5]";
    Pattern p = Pattern.compile(regEx);
    Matcher m = p.matcher(chinese);
    while (m.find()) {
            count++;
    }
    return count;
}