[Haskell-cafe] split string into n parts

Mark T.B. Carroll mark at ixod.org
Mon Oct 23 16:07:42 EDT 2006

jim burton <jim at sdf-eu.org> writes:

> I want to split a string into 5 parts of equal length, with the last fifth
> padded if necessary
> *Main> fifths "12345"
> "1 23 45"

What's the correct answer for fifths "123456"? I can't figure out how to
meet both your constraints. Is "12 34 56 XX XX" permitted (padding
before fifth as well)?

-- Mark

More information about the Haskell-Cafe mailing list