开发者

Get value between 2 spaces

Given the string value:

?*8 100 0

I'd like the value between the two spaces 开发者_开发百科(100).

How is it possible to get that value?


var value = myString.Split(' ')[1];

and if you'd really like to use Regex

var value = Regex.Match(myString, @" [^ ]+").Value.Trim();

but it adds quite a bit of overhead. Since you said the value is always a number

var value = int.Parse(Regex.Match(myString, @" \d+").Value);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜