c# 统计标点符号逗号和句号的个数(汉字标点)

来源:互联网 发布:在淘宝买电动车好吗 编辑:程序博客网 时间:2024/05/21 17:20

        public static int BiaodianCount(string strText)
        {
            int count = strText.Length;
            int num = 0;
            for (int i = 0; i < count; i++)
            {
                if (strText[i].ToString() == "," || strText[i].ToString() == "。")
                {
                    num++;
                }
            }
            return num;
        }