Hello jim,
Monday, October 23, 2006, 11:29:07 PM, you wrote:
> I want to split a string into 5 parts of equal length, with the last fifth
> padded if necessary, but can't get it right - here's what I've got -
>> fifths :: String -> String
>> fifths s = unwords [a1,a2,a3,a4,a5]
>> where l = (length s) `div` 5
s0 = s++" "
(a1,s1) = splitAt l s0
(a2,s2) = splitAt l s1
...
you can also use the following func:
splitByLen (len:lens) list = (x:splitByLens lens xs) where (x,xs) =
splitAt len list
splitByLen [] [] = []
--
Best regards,
Bulat mailto:[EMAIL PROTECTED]
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe