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!

Word Manipulation

Status
Not open for further replies.

donser

Programmer
Jul 31, 2001
7
US
I am trying to take a field named NAME_2 and separate it into third to four other fields called fname, mi, lname, and suffix. The data looks something like this "John R Smith Jr" I wish to have John appear in the fname field, the "R" after john appear in the mi field,"Smith" appear in the lname field and "Jr Appear in the suffix field. Any ideas??? Thanks for your help.
 
I have a routine that does this - written by one of the original Fox employees - Walter J. Kennamer back in 1991. It could probably be optimized, but if you want it and a program to show how it works, provide an e-mail address and I'll sent it to you. (Use a "myname AT NOSPAM address DOT com" format to prevent page reader spammers!)

Rick
 
DIMENSION aname[4]
lnpos = 1
lnlen = len(name_2)
lchar = ''
for i = 1 to lnlen
lchar = substr(name_2,i,1)
if lchar != ' '
aname(lnpos) = aname(lnpos) + lchar
else
lnpos = lnpos + 1
endif
next

this a very raw, you may want to put code to take care of some something like two spaces in a row.

when your complete you can check the array and test each arrary row against rules to determine if it is an initial jr,sr, III Attitude is Everything
 
My E-Mail address is dwsmith@usfunds.com

Thanks

 
Check out thread184-295279 for some additional helpful text manipulation code.

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top