diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-12-27 10:07:07 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-12-27 10:07:07 +0100 |
commit | 4981cfbb7f5e2630f8b41a34a8e55796283d531c (patch) | |
tree | 0e2b806622c8073d5d2bb631286adbc80d5fda64 | |
parent | e6c758e6dc9709f67d62f42cfa1b1662ceb779ae (diff) | |
download | hakyll-4981cfbb7f5e2630f8b41a34a8e55796283d531c.tar.gz |
Add string utility module
-rw-r--r-- | src/Hakyll/Web/Util/String.hs | 14 |
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 |