判断是否有重复,判断字符串是否有重复汉字【c#】

时间:2021-09-06 23:00:14   收藏:0   阅读:31
string corn = "公司";
            int n = 0;
            if (tbCorporateName.Text.IndexOf(corn) > -1)
            {
                string cor = tbCorporateName.Text.Replace(corn, "");
                 n = (tbCorporateName.Text.Length - cor.Length) / corn.Length;
            }
            if (n >= 2) {
                lblMessage.Text = "请输入单个公司名称。";
                Result = false;
            }

  

原文:https://www.cnblogs.com/liuguiqing/p/15233380.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!