I'm looking for a function to properly capitalize names like McDonald, FitzGerald, MacArthur, O'Lunney's, Theo de Raadt, etc.
Does anyone know of one that works resonably well? I'm guessing any function is not going to support every possibility.
Of course ucwords alone doesn't work for this because it just capitalize the first letter of every word.
Edit: I know there are going to be problems and all the possibility are not going to be supported. But the issue right now is I have a database of around 50 000 names that are mostly entered in all caps and it would be a pain in the ass to have to edit each one without causing spelling errors. Having a script that causes a problem with 20% would be a whole lot faster and result in a lot fewer errors.
Maybe you need something like this ucwords function note
You're probably aware of this, but one huge problem you'll face is that there's more than one "correct" capitalisation of some names - in your example I'd disagree with FitzGerald, for example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With