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貢獻(xiàn)1條經(jīng)驗(yàn) 獲得超1個(gè)贊
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 關(guān)注
- 1258 瀏覽
添加回答
舉報(bào)
0/150
提交
取消