Basically, from the string "222 2333 33"
, I wanted to split into several strings when I find an empty space or a different number next to it.
For example, in the above string I wanted it to be ["222","2","333","33"]
.
The code I have written is below, but in my case I can only divide when I find the empty space. Missing when numbers are different.
sliceIt :: String -> [String]
sliceIt xs = words xs
And would it be possible to do this with recursion?