module Utils.String ( capitalizeWords , capitalizeFirstWord , capitalizeWord ) where import Data.Char capitalizeWords :: String -> String capitalizeWords = unwords . map capitalizeWord . words capitalizeFirstWord :: String -> String capitalizeFirstWord = unwords . mapFirst capitalizeWord . words capitalizeWord :: String -> String capitalizeWord [] = [] capitalizeWord (x:xs) = toUpper x : map toLower xs mapFirst :: (a -> a) -> [a] -> [a] mapFirst _ [] = [] mapFirst f (x:xs) = f x : xs