X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=blackboard-dns.git;a=blobdiff_plain;f=DDNS%2FUtils.hs;fp=DDNS%2FUtils.hs;h=9c32824c0828722226b0c89e68ecb29984a0f0f1;hp=0000000000000000000000000000000000000000;hb=20021ec127c5574db472d88ff47cbf7e656969f4;hpb=3674500cd498050a48d69d1d30a6139ba3ba88f5 diff --git a/DDNS/Utils.hs b/DDNS/Utils.hs new file mode 100644 index 0000000..9c32824 --- /dev/null +++ b/DDNS/Utils.hs @@ -0,0 +1,16 @@ +module DDNS.Utils + ( trim + ) + where + +trim :: Maybe String -> Maybe String +trim Nothing = Nothing +trim (Just xs) = case trimTail $ trimHead xs of + "" -> Nothing + ys -> Just ys + where + trimHead [] = [] + trimHead (' ':ys) = trimHead ys + trimHead ys = ys + + trimTail = reverse . trimHead . reverse