X-Git-Url: http://gitweb.michael.orlitzky.com/?p=list-remote-forwards.git;a=blobdiff_plain;f=src%2FString.hs;fp=src%2FString.hs;h=8945fbd38d16b4adbf9c878cc2f1de014270176d;hp=0000000000000000000000000000000000000000;hb=8e5a377920002012c38066a2d21b6393a78c677a;hpb=d73de26c7c5a72da9d7d64f6c1ed91c3ea2b8dd0 diff --git a/src/String.hs b/src/String.hs new file mode 100644 index 0000000..8945fbd --- /dev/null +++ b/src/String.hs @@ -0,0 +1,19 @@ +-- | String utility functions not available in some library. +-- +module String ( trim ) +where + + +-- | Strip leading/trailing whitespace, and collapse multiple +-- consecutive spaces into one. +-- +-- ==== __Examples__ +-- +-- >>> trim "\thello" +-- "hello" +-- +-- >>> trim "\n\t\nhello, world! " +-- "hello, world!" +-- +trim :: String -> String +trim = unwords . words