Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Proper case tool
Message
From
01/12/2003 11:10:31
 
 
To
25/11/2003 13:25:16
John Thomason
King Richard Veterinary Centre
Leicester, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00853404
Message ID:
00854703
Views:
22
>I have a dll called nbc_case that I use to convert names into proper case. It works for most situations ie McGregor, MacGregor, O'Reilly. The user types the name in in lower case and the dll runs in the valid event.
>
>There are one or two situations where it doesn't work ie Arum is converted into uppercase - ARUM.
>
>I was looking for an upgrade but can't find a trace of this program in the UniversalThread archives or indeed in a web search.
>
>Does anyone know of a tool which will do the same job?

Try this:
* First use the PROPER function:
 REPLACE lastname WITH PROPER(lastname)
                                                                

 * Fix the "problems" caused by the PROPER function.
 * "Mcfarland"   will become "McFarland"
 * "Brown-davis" will become "Brown-Davis"  
 REPLACE lastname WITH FIX_NAME(lastname)


*************************************************
* Call this for each NAME part.
* This is basically a series of STRTRAN commands.
FUNCTION FIX_NAME
LPARAMETERS namemv

* Trim out any double spaces that may be embedded.
namemv = STRTRAN( namemv, '  ', ' ' )

* Fix "II", "III", "IV", (James Graham, III).
namemv = STRTRAN( namemv, ' Ii ', ' II ' )
namemv = STRTRAN( namemv, ' Iii ', ' III ' )
namemv = STRTRAN( namemv, ' Iv ', ' IV ' )

* Fix "Mcdonald".
IF SUBSTR(namemv,1,2) = "Mc"
   STORE SUBSTR(namemv,1,2) + UPPER(SUBSTR(namemv,3,1)) + SUBSTR(namemv,4,50) TO namemv
ENDIF

RETURN namemv
ENDFUNC  && end of "fix_address"

* Fix "O'brian".
IF SUBSTR(namemv,1,2) = "O'"
   STORE SUBSTR(namemv,1,2) + UPPER(SUBSTR(namemv,3,1)) + SUBSTR(namemv,4,50) TO namemv
ENDIF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform