Get Title, Forename(s) and Surname

H

hydbloos

Hello Everyone,

I have got a field that has the full name of a person.

I am basically looking for a code (or ideas) to get the Title,
Forname(s) and Surname from the supplied full name.

Some examples:
1. Input: Mr Lucas
Output:
Title: "Mr"
Forename: ""
Surname: "Lucas"

2. Input: John Lucas
Output:
Title: ""
Forename: "John"
Surname: "Lucas"

3. Input: John Lewis Lucas
Output:
Title: ""
Forename: "John Lewis"
Surname: "Lucas"

4. Input: Mr John Lucas
Output:
Title: "Mr"
Forename: "John"
Surname: "Lucas"

5. Input: Mr John Lewis Lucas
Output:
Title: "Mr"
Forename: "John Lewis"
Surname: "Lucas"

Can someone suggest some ideas of it would be great if you have a code
that I can use.

Many Thanks,
Nevaank
 
J

JLGWhiz

I am thinking you could split on the space delimiter and then post from right
to left.
surname would always be the extreme right. The tricky part is breaking the
title out. I suppose that would have to be by exception, like If item = mr.
Or if item = ms. Then post to extreme left field. Figuring this out could
keep you busy for a while.
 
H

hydbloos

Hello JLGWhiz,

I knew someone would ask me about the title. I tried looking for all
types of titles on the net, but unfortunately, couldn't find any. I
feel if I am writing/getting code then it should be a generalised one.
I thought someone might have definitely come across something like
this before. So was expecting few answers.

Thanks for the info you have given.

Is there anyone who can direct me to some links that would give me
list of titles. Basically in the project that I am doing the name
field has the name of shareholders. The titles that I have seen are
Mr, Mrs, Miss, Ms, Captain, Dr and Hon.

Many Thanks,
Nevaank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top