mangoumbrella/swifttitlecase
A Swift package that tries its best to transform strings to [AP style title case](https://en.wikipedia.org/wiki/Title_case#AP_Stylebook).
Example usage
import SwiftTitleCase
let titleCased = "mango baby is a product under mango umbrella".titleCase()
print(titleCased) // Mango Baby Is a Product Under Mango UmbrellaWhy SwiftTitleCase?
Mango Umbrella has an in-house client app managing its content. I needed a convenience button that automatically transforms my blog post's titles to AP style title case. So I wrote a basic function just doing that.
Why "tries its best"?
Currently the implementation only handles the basic rules. It doesn't attempt to identify parts of speech contextually. For example, if "up" is used as an adverb rather than a preposition, this package would still lowercase it (unless it's the first or last word). Contributions welcome!
Changelog
See CHANGELOG.md.
License
SwiftTitleCase is licensed under the terms of the Apache license. See LICENSE for more information.
Package Metadata
Repository: mangoumbrella/swifttitlecase
Default branch: main
README: README.md