check alphanumeric characters in string in c#

后端 未结 8 1077
轻奢々
轻奢々 2020-12-15 05:04

I have used the following code but it is returning false though it should return true

string check,zipcode;
zipcode=\"10001 New York, NY\";
check=isalpha         


        
8条回答
  •  旧时难觅i
    2020-12-15 05:50

        public static bool IsAlphaNumeric(string strToCheck)
        {
            return strToCheck.All(char.IsLetterOrDigit);
        }
    

提交回复
热议问题