回复 1# zheng_hq 的帖子
使用Linq可以很方便的对字符串进行这样的统计,比如下面的代码:- string str = "8043283672469056709847421622639010367832281012053917805921902110075074";
- var q = from c in str.ToArray<char>() orderby c group c by c into cs
- select new
- {
- Str = cs.Key,
- Count = cs.Count()
- };
复制代码 |
|