问题描述
哪位大哥教教我,像如下字符串"47.64483,-122.141197"如何将两个数字提取出来?
解决方案
解决方案二:
"47.64483,-122.141197".Split("|")
解决方案三:
引用1楼chinajiyong的回复:
"47.64483,-122.141197".Split("|")
"47.64483,-122.141197".Split(",")
解决方案四:
stringresult=Regex.Replace(str,"\D+","");
解决方案五:
stringstr="47.64483,-122.141197";string[]arr=str.Split(',');
解决方案六:
stringsource="47.64483,-122.141197";Regexreg=newRegex(@"-?[d]+.?[d]+");Matchmm=reg.Match(source);MatchCollectionmc=reg.Matches(source);foreach(Matchminmc){MessageBox.Show(m.Value);}
解决方案七:
原来是这种,看标题以为是混合字符串了
解决方案八:
引用2楼chinajiyong的回复:
引用1楼chinajiyong的回复:"47.64483,-122.141197".Split("|")"47.64483,-122.141197".Split(",")
我写的太简单了,以后一定改stringnumstr="47.64483,-122.141197";string[]num=numstr.Split(newstring[]{","},StringSplitOptions.RemoveEmptyEntries);
解决方案九:
该回复于2012-03-19 17:34:12被版主删除
解决方案十:
"47.64483,-122.141197".Split("|")吃不消了
解决方案十一:
引用4楼porschev的回复:
C#codestringstr="47.64483,-122.141197";string[]arr=str.Split(',');
+1
时间: 2024-10-28 23:47:02