如何获取一句话中有几个逗号 c#

来源:学生作业帮助网 编辑:六六作业网 时间:2024/05/22 15:32:07
如何获取一句话中有几个逗号c#如何获取一句话中有几个逗号c#如何获取一句话中有几个逗号c#stringstr=",This,is,arthur!What''syourname?a,b,c,";intco

如何获取一句话中有几个逗号 c#
如何获取一句话中有几个逗号 c#

如何获取一句话中有几个逗号 c#
string str = ",This,is,arthur!What's your name?a,b ,c,";
int count = str.Split(',').Length - 1;
count为逗号个数