c#查询字符串内有多少个指定字符

2024-12-13 09:19:08
推荐回答(1个)
回答1:

char c='d';
int Count=s.ToCharArray().Count(x=>x==c);