src/org/nutz/lang/Strings.java
public static int countStrHeadIndent(String str, int tabWidth) {
        int n = 0;
        if (!isEmpty(str)) {
            for (int i = 0; i < str.length(); i++) {
                char c = str.charAt(i);
                if (' ' == c)
                    n++;
                else if ('\t' == c)
                    n += tabWidth;
                else
                    break;
            }
        }
        return n / tabWidth;
    }
public static int countStrHeadIndent(String str, int tabWidth) {
        int n = 0;
        if (!isEmpty(str)) {
            for (int i = 0; i < str.length(); i++) {
                char c = str.charAt(i);
                if (' ' == c)
                    n++;
                else if ('\t' == c)
                    n += tabWidth;
                else
                    break;
            }
        }
        return n / tabWidth;
    }
计算一个字符串开头有几个缩进，

@param str
给定字符串
@param tabWidth
一个 \t 相当于几个空格，默认 4
@return 返回缩进级别