Since you want to use Array , use the Split function.
string x = "98 92 86 92 100 92 93"; string[] val = x.Split(' '); int totalCount = val.Length;
or the best way to do this is with LINQ , which is automatically converted to an array of integers
string x = "98 92 86 92 100 92 93"; int[] y = x.Split(' ').Select(n => Convert.ToInt32(n)).ToArray(); int totalCount = y.Length;
source share