
1 Dec
2005
1 Dec
'05
2:54 p.m.
On 12/1/05, raptor
hi,
i'm having this problem, tring to implement split (for learning purposes). Here is one sample of my tries :
split _ [] = [] split char (x:xs) | x /= char = x : split char xs | otherwise = []
it is ok i.e. it returns the first of the splits, but I want to get all of the results.
str = "testingxsplitxtoxseexhowxitxwork"
*Main> split 'x' str "testing"
I want : ["testing","split",...]
How do i do this.
A good start is to write a function which returns the first split, as well as the remainder of the string as a tuple. Then you can use this function over and over on the remainder of each call until it is "". /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862