C#检测保留字符串

it2022-05-25  71

 1 /**/ /// <summary> 2  /// 检测输入字符串strInput是否在保留字符串strConfigWords中存在,存在则返回true。 3  /// </summary>  4    public   bool  CheckResWords( string  strConfigWords, string  strInput)  5    { 6   bool blResult = false; 7   //创建strWords数组,以“|”号为分割符。 8   string[] strWords = strConfigWords.Split(new char[] {'|'}); 9   //依此读取数组中各个单元,并与输入值对比,若两者相同则返回true10   for(int i=0;i<strWords.GetUpperBound(0)+1;i++)11   {12    if(strInput.IndexOf(strWords[i])>=0)13    {14     blResult = true;15     return blResult;16    }17   }18   return blResult;19  }  

转载于:https://www.cnblogs.com/lgzdd/archive/2005/07/31/204010.html

相关资源:C#正则检测字符串是否字母数字混编的方法

最新回复(0)