Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parse Name to Separate Parts
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01219298
Message ID:
01219343
Views:
19
>Naomi
>
>Thanks for the pointers, that idea really works in my situation:
>
>
>PARAMETERS tcName
>IF PCOUNT()=0
>	lcRefDocName=[CUNNINGHAM LYNNE,]
>ELSE
>	lcRefDocName=tcName
>ENDIF
>LOCAL lcReturn,lcLast,lcFirst,mi,lnLen
>
>lcRefDocName=ALLTRIM(lcRefDocName)
>* Replace any comma with []
>lcNewName=STRTRAN(lcRefDocName,',',[])
>lnWordCnt=GETWORDCOUNT(lcNewName)
>lcLastName=GETWORDNUM(lcNewName,1)
>lcFirstName=GETWORDNUM(lcNewName,2)
>lcMI=GETWORDNUM(lcNewName,3)
>
>lcReturn=[|]+lcLastName+[|]+lcFirstName+[|]+lcMI+[|]
>
>RETURN lcReturn
>
>
What are you doing in case of multiple first names or multiple last names? Such cases are not uncommon. Also can two people be in one field?

BTW, once you get number of words, should you just go in a loop? And I think alines should be a bit quicker than GetWordCount/GetWordNum. You may try to compare speed on the huge files.
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