summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-27 10:07:07 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-27 10:07:07 +0100
commit4981cfbb7f5e2630f8b41a34a8e55796283d531c (patch)
tree0e2b806622c8073d5d2bb631286adbc80d5fda64
parente6c758e6dc9709f67d62f42cfa1b1662ceb779ae (diff)
downloadhakyll-4981cfbb7f5e2630f8b41a34a8e55796283d531c.tar.gz
Add string utility module
-rw-r--r--src/Hakyll/Web/Util/String.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Hakyll/Web/Util/String.hs b/src/Hakyll/Web/Util/String.hs
new file mode 100644
index 0000000..5a8c7c6
--- /dev/null
+++ b/src/Hakyll/Web/Util/String.hs
@@ -0,0 +1,14 @@
+-- | Miscellaneous string manipulation functions.
+--
+module Hakyll.Web.Util.String
+ ( trim
+ ) where
+
+import Data.Char (isSpace)
+
+-- | Trim a string (drop spaces, tabs and newlines at both sides).
+--
+trim :: String -> String
+trim = reverse . trim' . reverse . trim'
+ where
+ trim' = dropWhile isSpace