Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Splitting a string 2

Status
Not open for further replies.

quesnell

Technical User
May 14, 2003
4
0
0
GB
I am trying to split a string that contains a fist name and surname so that only the first name shows ?
 
Hmmm, and how do you intend to handle names like:

Oscar De La Hoya?
Dr. Bob P. Jones?

The problem is that whoever was responsible for creating this data source was incompetent.

You can make assumptions and try to extract this, but the rules are extensive, I used to clean lists for a living...

The simple means is to use:

first name
Left({table.nakme},instr(" ",{table,name})-1)

last name
mid({table.nakme},instr(" ",{table,name})+1)

But there are so many gotchas in names that you'll be correcting the rules forevermore...

The best bet is to correct the data source, if you find it too tedious, intersperse the boredom with firing red hot reminders of your displeasure at the database designer using a nailgun.

There used to be some 3rd party products to help with this, perhaps one of those might help clean the list.

-k
 
SV inverted the formula a bit, and probably intended:

//first name
Left({table.name},instr({table.name}," ")-1)

//last name
mid({table.name},instr({table.name}," ")+1)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top