TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2016 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Sam Williams.
“just in CASE”:
string.camelcased()
: "justInCase"
string.camelcased(uppercaseFirst: true)
: "JustInCase"
string.underscored()
: "just_in_case"
string.kebabCased()
: "just-in-case"
There’s also a StringCase enum.
"my string".to(case: .camel)
This does very simple, non-localized inflection.
string.pluralized()
string.singularized()
You can add your own regex-based rules:
Inflector.pluralizer.inflect("octopus$", as: "octopodes")
"octopus".pluralized() // "octopodes"
Inflector.singularizer.inflect("people$", as: "soylent")
"people".singularized() // "soylent"