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);
精彩评论