]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/Utils.hs
data/mime.types
[Lucu.git] / Network / HTTP / Lucu / Utils.hs
index df19a76d251fdd42c66161e381ea6c45bece2be1..58da6f50c2612ac1e64e4d8366e17dfa21712f50 100644 (file)
@@ -4,6 +4,7 @@ module Network.HTTP.Lucu.Utils
     , trim         -- (a -> Bool) -> [a] -> [a]
     , noCaseEq     -- String -> String -> Bool
     , isWhiteSpace -- Char -> Bool
+    , quoteStr     -- String -> String
     )
     where
 
@@ -40,3 +41,11 @@ noCaseEq a b
 
 isWhiteSpace :: Char -> Bool
 isWhiteSpace = flip elem " \t\r\n"
+
+
+quoteStr :: String -> String
+quoteStr str = foldr (++) "" (["\""] ++ map quote str ++ ["\""])
+    where
+      quote :: Char -> String
+      quote '"' = "\\\""
+      quote c   = [c]
\ No newline at end of file