elm-community / elm-community/string-extra
Add firstToUpper and firstToLower to change first character's case
Open
- Dominant language
- Elm
- Stars
- 36
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
Description
I use this sometimes and it would be nice to have in String.Extra I think
``` elm
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
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.