Person Name Split Function?

Hi Paul

This is not as simple as it first seems.

eg. if you split on space and say last word is the family name then what about names like:

Mc Donald
von Trapp

and people who put SNR or Jnr at the end, or Roman numerals as with “Loudon Wainwright III”, or MD or PhD or DDS and so on. Less common these days is “Esq” or “Esquire” but it still might crop up.

and what about some asian countries where the FIRST name is the family name?

and sometimes there are “double barrel” surnames, It is easy if they have a hyphen between them (as they go together as one word if splitting on space) but this is not always the case.

If you look at Force Capitalized String - #7 by vitesse you will see links to Clarion Magazine article by Mike Hanson that is “related” in that it is trying to capitalize names. Sure that is not what you are doing but it is related in the sense of breaking a string into components and handling some common exceptions.

Don’t forget a name may have a title at the front Mr Mrs Ms Miss Mstr Mdm Dr Sir Lord and so on.

Once you work out a “spec” the mechanics of implementation are the easy part especially if you use something like StringTheory split(). st.split() puts the component parts into a queue and you can group them accordingly into your separate fields.

1 Like