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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

splitting fullnames into first and last name 3

Status
Not open for further replies.

GirlBlonde

Programmer
Oct 30, 2007
94
AU
hi is it possible to take a name like jim smith and break it into 2 field first name and last name?

Energy & persistance conquer all things!
 
Have a look at the Split function.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 




What about Joe Bob Smith, Joe Smith Jr, Joe Von Smith, or Joe Bob Von Smith Jr???

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Skippo,

split function returns an array so if the situation arises OP can iterate through that using a simple For ....Next loop set to the UBound of the returned array. No drama.
 




"iterate through that using a simple For ....Next " is NOT the issue.

The issue is what's the LOGIC for determining FIRST & LAST names under those varied cases???

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Oh you are SO pedantic - love it! Next time a client gives me a really good detailed spec (as if. Ever) I'll try and come up with a question like that!

But, on a logical note - the FIRST name is the one at 0 in the array and the LAST name is the one at UBound. Duh....Some people.... ;)
 



"But, on a logical note - the FIRST name is the one at 0 in the array "

What about "Joe Bob" THAT is a First Name to some People

"and the LAST name is the one at UBound. Duh....Some people.... ;) "

What about "Jr", "III", "Esq" These are NOT Last Names???

What about a Last Name like "Von der Voort"???

"some people"!!!


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
That's easy:

If strSplitResult(0) = "Joe" And strSplitResult(1)="Bob"..
ElseIf......

lol.

Laterz
 




Just for kicks, I queried our 10,000+ employee db and found 10 First Names like Lou Ann or San Juan and 32 Last Names like St John, La Rosa, Von der Heide or White Bear.

I guess "some people" ought to know better than to have First and Last Names that don't meet an EASY "assumed" logic.

So what's you LOGIC for parsing into First & Last...
[tt]
Joe Smith
Lou Ann Smith
San Juan La Rosa
White Bear Von der Heide
[/tt]



Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Skippo,

I think you missed my dry humour way back. When I said FIRST and LAST I was making joking light hearted remarks as to the first and last values in the array.

As your above examples show it's impossible for a human, let alone a pile of silicon and copper to ascertain what is likely to be a first and last name.

Just chill ok?!
 




nice duck 'n' retreat!

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
That gives me an idea: I wonder how many parsers I could mess up if I legally changed my first name from "Jeff" to "Jeff,"

[lol]

_____
Jeff
[small][purple]It's never too early to begin preparing for [/purple]International Talk Like a Pirate Day
"The software I buy sucks, The software I write sucks. It's time to give up and have a beer..." - Me[/small]
 




No Comma-ent.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
OK, boys. Ease off. Relax.

JB,
Your comments, while you may not have intended this way, come across are rude.

Skip,
In all fairness, the OP did ask "names like John Smith", and the split function would work for names like that. However, I agree that there are significant problems with that approach.

Jeff,,
I love your idea!
 
OH MY GOD what did i do, sorry to cause so much controversy! i must thank you for your input though it has been very helpful.



Energy & persistance conquer all things!
 
Apologies to anyone offended, I am certainly not a rude person and simply try to help, share ideas and advice. i know that joking comments such as "Some people...." can be misinterpretted via this medium which is why i followed it with a wink.

I'm from UK originally so my humour is a strange mix of English dryness and Aussie bluntness. I'll try to be more serious in future {slaps own wrist} {Ow}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top