Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HT convert wildcard strings to UC
Message
From
23/12/2000 12:37:17
Liam O'Hagan
O'Hagan Programming Ltd
Ireland
 
 
To
23/12/2000 09:44:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00456576
Message ID:
00456598
Views:
21
Hi Rixon,

I was going to suggest that you use a series of STRTRAN() commands but as STRTRAN() is case sensitive this won't work with mixed case unless you check for every combination.

If you have the codes you wish to check for in a table (or an array) you could check for the existence of each of these codes and then convert to upper case. Example follows ....
Select Codes
Scan All
  lcNewString = ConvertCode(lcOldString, Codes.PostalCode)
EndScan


Function ConvertCode
  Lparameters tcString, tcCode
  Local lnStart


  lnStart = Atc(tcCode, tcString)
  Do While lnStart > 0
    tcString = Substr(tcString, 1, lnStart-1)) + Upper(Substr(tcString, lnStart, Len(tcCode))) + Substr(tcString, lnStart+Len(tcCode))
    lnStart = Atc(tcCode, tcString)
  EndDo

  Return tcString
EndFunc
Code is untested but you get the idea ....

HTH

Liam


>We have a field that includes city, country, and postal codes in mixed case. We would like to search for any Canadian Postal Codes (eg. v3a 2c1) and convert only those codes to upper case. How can this be accomplished? Thanks. Happy Holidays.
Liam O'Hagan
MCP VFP Desktop Apps
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform