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