string s="1,2,3,4,5,6,";
怎么样操作可以使最后一个逗号去除、
菜鸟。
------解决方案--------------------------------------------------------
- C# code
string s = "1,2,3,4,5,6,"; s = s.TrimEnd(',');
------解决方案--------------------------------------------------------
string.LastIndexOf(',')
取出最后一个,的位置
在Substring
------解决方案--------------------------------------------------------
TrimEnd(','); //去除字符尾部的逗号
TrimStart(','); //去除字符头部的逗号
Trim(','); //去除字符首尾的逗号