string sentence = \"X10 cats, Y20 dogs, 40 fish and 1 programmer.\"; string[] digits = Regex.Split (sentence, @\"\\D+\");
for this code i get val
If you have Linq:
stringArray.Select(s=>decimal.Parse(s));
A foreach would also work. You may need to check that each string is actually a number (.Parse does not throw en exception).
foreach
string
.Parse