我需要从字符串中取第一个数字,例如
"12345 this is a number " => "12345"
"123 <br /> this is also numb 2" => "123"
等等
为此,我使用 C# 代码:
string number = "";
foreach(char c in ebayOrderId)
{
if (char.IsDigit(c))
{
number += c;
}
else
{
break;
}
}
return number;
怎么可能通过 LINQ 做同样的事情?
谢谢!