Posts tagged “split”

Haskell 'words' and Perl 'split'

Haskell’s prelude has a function words that splits a string by spaces. Prelude> words “nice cup of tea” ["nice","cup","of","tea"] Apparently the question comes up quite regularly on irc or haskell-cafe as to why this function is specialised to split only on whitespace. Perl’s split, for example, can split on any character, or indeed string or [...]