Of course, this doesn't account for mulitple suffixes (ie. JR MD) Or if someone has a multi part last name (Del Rossi) Or if a middle initial has been thrown into the name as well.
The routine I have, splits the name into a dynamic array on a space and goes through the array one at a time, if it matches a salutation or suffix it's dropped into it's own dynamic array, however, if it matches a prefix, it must be within the first half of the name, and a suffix must be within the last half of the name (there are some salutation that can also be suffixes - ie. SR - Senior or Sister). If it's a single letter, it's considered a middle initial, ONLY if there has been no first name yet. if the part is one of a multi part last name, it's added the next part with a sub value mark, and rechecked (after eliminating the next part). What's left depending on how many parts will be a FN Middle Name or LN, FN, LN or just a LN (if there is a first name initial). Subvalues and Attribute marks are converted back to spaces Returning 5 parts, Salution, FN, Middle name, LN, Suffix I use the same method of having salution file, and a suffix file and combined last name file As we find failures based on unknown saluation, suffixes, they are added to the file. It works excellent on the normal formatted names. George Gallen Senior Programmer/Analyst Accounting/Data Division [email protected] ph:856.848.9005 Ext 220 The Wyanoke Group http://www.wyanokegroup.com ________________________________________ From: [email protected] [[email protected]] On Behalf Of Charlie Noah [[email protected]] Sent: Tuesday, December 13, 2011 8:02 PM To: U2 Users List Subject: Re: [U2] Extract first and last name from free-form name Great start, but here is a longer list, although still nowhere near complete: Prefixes Code Description 1st Lt First Lieutenant Adm Admiral Atty Attorney Brother Brother (religious) Capt Captain Chief Chief Cmdr Commander Col Colonel Dean University Dean (includes Assistant and Associate) Dr Doctor (Medical or Educator) Elder Elder (religious) Father Father (religious) Gen General Gov Governor Hon Honorable (Cabinet Officer, Commissioner, Congressman, Judge, etc.) Lt Col Lieutenant Colonel Maj Major MSgt Major/Master Sergeant Mr Mister Mrs Married Woman Ms Single or Married Woman Prince Prince Prof Professor (includes Assistant and Associate Rabbi Rabbi (religious) Rev Reverend (religious) Sister Sister (religious) Suffixes Code Description II The Second III The Third IV The Fourth V The Fifth CPA Certified Public Accountant DDS Doctor of Dental Medicine Esq Esquire JD Jurist Doctor Jr Junior Jnr Junior (British) LLD Doctor of Laws MD Doctor of Medicine PhD Doctorate Ret Retired from Armed Forces RN Registered Nurse RPh Registered Pharmacist Sr Senior Snr Senior (British) DO Doctor of Osteopathy Perhaps others can add more to the list. Regards, Charlie Noah Tiny Bear's Wild Bird Store "Everything For The Backyard Bird Enthusiast, Except For The Birds" Info, Forum: http://www.TinyBearMarketing.com Store: http://Stores.TinyBearMarketing.com On 12-13-2011 5:12 PM, Wjhonson wrote: > 0044: SUFFIXES = ",JR,SR,MD,III," > 0045: S.NAME = DCOUNT(UM.NAME,' ') > 0046: LAST.WORD.IN.NAME = FIELD(UM.NAME,' ',S.NAME) > 0047: IF INDEX(SUFFIXES,",":LAST.WORD.IN.NAME:",",1) THEN > 0048: LAST.NAME = FIELD(UM.NAME,' ',S.NAME-1) > 0049: END ELSE > 0050: LAST.NAME = LAST.WORD.IN.NAME > 0051: END > 0052: PREFIXES = ',DR,MR,MS,MISS,MRS,' > 0053: FIRST.WORD.IN.NAME = FIELD(UM.NAME,' ',1) > 0054: IF INDEX(PREFIXES,",":FIRST.WORD.IN.NAME:",",1) THEN > 0055: FIRST.NAME = FIELD(UM.NAME,' ',2) > 0056: END ELSE > 0057: FIRST.NAME = FIRST.WORD.IN.NAME > 0058: END > _______________________________________________ > U2-Users mailing list > [email protected] > http://listserver.u2ug.org/mailman/listinfo/u2-users > _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users
