src/org/nutz/lang/Strings.java
public static int countStrHeadChar(String str, char c) {
        int re = 0;
        if (!isEmpty(str))
            for (; re < str.length(); re++) {
                if (str.charAt(re) != c)
                    return re;
            }
        return re;
    }
public static int countStrHeadChar(String str, char c) {
        int re = 0;
        if (!isEmpty(str))
            for (; re < str.length(); re++) {
                if (str.charAt(re) != c)
                    return re;
            }
        return re;
    }
计算一个字符串开头有几个重复的字符

@param str
给定字符串
@param c
指定重复字符
@return 开头重复字符的个数