Add a doctest test suite.
[list-remote-forwards.git] / src / String.hs
1 -- | String utility functions not available in some library.
2 --
3 module String ( trim )
4 where
5
6
7 -- | Strip leading/trailing whitespace, and collapse multiple
8 -- consecutive spaces into one.
9 --
10 -- ==== __Examples__
11 --
12 -- >>> trim "\thello"
13 -- "hello"
14 --
15 -- >>> trim "\n\t\nhello, world! "
16 -- "hello, world!"
17 --
18 trim :: String -> String
19 trim = unwords . words