you can split the string in parts with string.Split and then move the list with foreach using int.TryParse, something like this:
string test = "12 text text 7 text";
var numbers = new List<int>();
int i;
foreach (string s in test.Split(' '))
{
if (int.TryParse(s, out i)) numbers.Add(i);
}
Numbers now have a list of valid values
user694833
source
share