hi
I have four functions below: What I want to do is have a way to parse more than one digit or more than one string head in ParseTrue. Any ideas...
removeSpace:: String -> String
removeSpace = dropWhile (`elem` space)
where space = [' ']
match :: String -> String -> (Bool, String)
match word str
| ((isPrefixOf) (removeSpace word) (removeSpace str)) = (True,rest)
| otherwise = (False,str)
where rest = drop (length (removeSpace word)) (removeSpace str)
parseDigit :: String -> [(Int, String)]
parseDigit (x:xs)
| isDigit x = [(read [x],xs)]
| otherwise = []
parseTrue :: String -> (Bool, String)
parseTrue x = match "True" x
Ryan
Get closer to the jungle… I'm a Celebrity Get Me Out Of Here!