tags:

views:

90

answers:

2

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.

+3  A: 

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.

therefromhere
This is true, but again, it's just a general fix. Right now I have database where >50% of people are entered with all caps.
Darryl Hein
+3  A: 

Maybe you need something like this ucwords function note

inakiabt
I did see this one while looking around and it looks quite good. There are also a few others that look good. Basically wondering if someone has one they have used and have found works well.
Darryl Hein