Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stripping
Message
 
 
To
09/04/2008 11:06:41
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01309362
Message ID:
01309370
Views:
7
>This isn't quite right. It replaces things like portions of tcName that I don't want it to. It strips the "Mr" but also the "Dr" and "Prof" portions. I think I have to do something more with the GetWordNum, but can't quite get it to work. Any help (yours, not the Foxpro) is appreciated.
>
>
>tcName = "Mr Droopy Proffler"
>
>* Strip common name prefixes.
>m.ReplaceWith = ''
>m.PrefixSearchString = [ MR MRS MS MISS DR PROF SIR MASTER REV REVERAND ETC ]
>FOR x = 1 TO GETWORDCOUNT( m.PrefixSearchString )
>	m.LookFor = ALLTRIM(UPPER(GETWORDNUM(m.PrefixSearchString,x)))
>	tcName = CHRTRAN(UPPER(tcName),m.LookFor,m.ReplaceWith)
>ENDFOR
>
If the common prefix is always at the beginning of the name, grab it first, compare with the string of prefixes and if it's in there, remove it with STRTRAN OR SUBSTR(). Use the same idea from John Ryan's message.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform