我需要查找并提取字符串中包含的数字.
例如,从这些字符串:
string test = "1 test"
string test1 = " 1 test"
string test2 = "test 99"
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
C#Char.IsDigit()
和Char.IsNumber()
C#有什么区别?
可能重复:
在C#中解析字符串中的多个双精度数
假设我有一行文字如下:
"45.690 24.1023 .09223 4.1334"
在C#中,从这一行中提取数字的最有效方法是什么?每个数字之间的空格数量各不相同,并且在行与行之间无法预测.我必须这样做数千次,所以效率是关键.
谢谢.