Skip to content

Conversation

@hipsterjazzbo
Copy link

@hipsterjazzbo hipsterjazzbo commented Oct 9, 2017

Currently, title casing is very naive, in that it simply capitalises each word.

This changes titleize() and toTitleCase() do a much better job at doing proper title casing, including lower casing words that should be lower cased, and hyphenates like "Stand-In" (but not man-in-the-middle).

I have made sure that the method signature has not changed, although the output will change in a lot of cases so I'm not toll sure if this counts as breaking.

If the behaviour of upper casing every word in a string is still desired, I suggest adding a upperCaseEach() method or similar.

(Adapted from John Gruber’s script)

PS: If there is a concern about the $smallWords list being mono-lingual, I believe the Inflectors from #170 could be used here as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant