]> gitweb.michael.orlitzky.com - list-remote-forwards.git/blobdiff - src/String.hs
Add a doctest test suite.
[list-remote-forwards.git] / src / String.hs
diff --git a/src/String.hs b/src/String.hs
new file mode 100644 (file)
index 0000000..8945fbd
--- /dev/null
@@ -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