X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FUtils.hs;h=58da6f50c2612ac1e64e4d8366e17dfa21712f50;hp=df19a76d251fdd42c66161e381ea6c45bece2be1;hb=c6b11025d1f81c668e9995e856b7bb34175230d3;hpb=1000bdc46cfe7b3ae550ff24ccea9f440f11b42a diff --git a/Network/HTTP/Lucu/Utils.hs b/Network/HTTP/Lucu/Utils.hs index df19a76..58da6f5 100644 --- a/Network/HTTP/Lucu/Utils.hs +++ b/Network/HTTP/Lucu/Utils.hs @@ -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