using System;namespace DelimiterString{class Program{ static void Main(string[] args) { string initialValue = "1500 * 1200 * 100 "; char[] num = new char[12]; int i=0; foreach (char substrings in initialValue) { if(substrings >= '0' && substrings <= '9') { num[i++] = substrings; } else { Console.WriteLine(num); for (int j = 0; j<num.Length;j++) { num[j]='*'; } i=0; } } }}}
1 回答
爵爷_韦爵爷
TA贡献1条经验 获得超1个赞
public void WordSplit(string msg) { string[] strs = msg.Split('*'); foreach(string str in strs) { int result = 0; if(int.TryParse(str,out result)) { Console.WriteLine(result); } } }
- 1 回答
- 0 关注
- 1220 浏览
添加回答
举报
0/150
提交
取消