If you use only one space, there is a split
method in the {STRING}
class. The argument of the split
method is a {CHARACTER}
instead of a {STRING}
. So, you have to use ' '
instead of " "
. Here is a little function that do what I think you want.
split_to_integer_list(a_string:STRING):ARRAYED_LIST[INTEGER]
-- Convert `a_string', a space separated list of integer
-- into a {LIST} of {INTEGER}
local
l_split:LIST[STRING]
do
l_split := a_string.split (' ')
create Result.make (a_string.count)
across l_split as la_split loop
if la_split.item.is_integer then
Result.extend(la_split.item.to_integer)
end
end
end