diff options
Diffstat (limited to 'src/Hakyll/Web/Util')
-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 |