Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HT convert wildcard strings to UC
Message
De
23/12/2000 12:37:17
Liam O'Hagan
O'Hagan Programming Ltd
Irlande
 
 
À
23/12/2000 09:44:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00456576
Message ID:
00456598
Vues:
23
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform