Add string utility module
commit4981cfbb7f5e2630f8b41a34a8e55796283d531c
authorJasper Van der Jeugt <jaspervdj@gmail.com>
dateMon 27 Dec 2010, 10:07 (16 years ago)
parente6c758e
src/Hakyll/Web/Util/String.hsnew file+14
@@ -0,0 +1,14 @@
1+-- | Miscellaneous string manipulation functions.
2+--
3+module Hakyll.Web.Util.String
4+ ( trim
5+ ) where
6+
7+import Data.Char (isSpace)
8+
9+-- | Trim a string (drop spaces, tabs and newlines at both sides).
10+--
11+trim :: String -> String
12+trim = reverse . trim' . reverse . trim'
13+ where
14+ trim' = dropWhile isSpace