Open staeter opened 5 months ago
I use this sometimes and it would be nice to have in String.Extra I think
firstToUpper : String -> String firstToUpper str = String.uncons str |> Maybe.map (Tuple.mapFirst Char.toUpper) |> Maybe.map (\( c, rest ) -> String.fromChar c ++ rest) |> Maybe.withDefault str firstToLower : String -> String firstToLower str = String.uncons str |> Maybe.map (Tuple.mapFirst Char.toLower) |> Maybe.map (\( c, rest ) -> String.fromChar c ++ rest) |> Maybe.withDefault str
I use this sometimes and it would be nice to have in String.Extra I think