This is the principle: Let s be your string. In a loop to the following
Remove leading spaces in s
while (length(s)>0) and (s[1]=' ') do delete(s,1,1);
Find the first space in the remaining string
p := pos(' ',s);
Copy the non-space part leading in a second string t and remove that part from s
t := copy(s,1,p-1); delete(s,1,p);
get the next array element element[i] with
val(t,element[i],code);
Of course you have to code checks (Is the string s empty after some manipulation? If val gives an error, you have no valid number,...), array indexing etc.