获取字符串中特定字符串的个数

 //获取字符串中特定字符串的个数
方法1:

string[] j = tests.Split('a');

 textBox1.Text = j.Length.ToString();

方法2:

textBox2.Text = Regex.Matches(tests, "a").Count.ToString();  //获取tests中”a“的个数 
原文地址:https://www.cnblogs.com/viaiu/p/4836802.html