The example in this article describes how C # determines whether a string has a letter and the substitution of characters in a string. Share to everyone for your reference. The implementation method is as follows:
First, add the "using System.Text.RegularExpressions" to the namespace. The reference
The following is an example of a string:
The code is as follows: string ss = "AaZ31 dd2f3";
String sss = ss. Replace ("", "");//Remove whitespace from string ss
String sss2 = Regex.Replace (ss, "[A-za-z]", "");//Remove the English letter from the string SS
MessageBox.Show (SSS);//dialog box popup value is AAZ31DD2F3
MessageBox.Show (SSS2);//dialog box popup value is 31 23
if (regex.matches (SS, "[A-za-z]"). COUNT>0)//If the number of captured letters is greater than 0
{
There is an English letter in the description string
}
Else
Instead
I hope this article is helpful to everyone's C # programming.
Url:http://www.jb51.net/article/56829.htm
C # Determines if a string has an alternate instance of a letter and a character in a string