I'm trying to extract whole numbers of different length from a string with lots of formatting. The string in question could look like this:
string s = "Hallo (221122321 434334 more text3434 even mor,34343 343421.343sf 343";
The output I'm looking for is an array of:
{221122321,434334,3434,34343,343421,343,343}
var result = new Regex(@"\d+").Matches(s)
.Cast<Match>()
.Select(m => Int32.Parse(m.Value))
.ToArray();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With