如何计算一个字符串里相同字符的个数
string str1 = "1,2,3,4,5";
//将字串中的","全部替换成空 string str2 = str1.Replace(",", "");
//原字符的长度减去现字符串的长度,就是包含字符的个数 int num = str1.Length - str2.Length;
string str1 = "1,2,3,4,5";
//将字串中的","全部替换成空 string str2 = str1.Replace(",", "");
//原字符的长度减去现字符串的长度,就是包含字符的个数 int num = str1.Length - str2.Length;