Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Locating and replacing a charcter in a field
Message
De
28/12/1999 14:57:15
 
 
À
28/12/1999 14:44:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00309380
Message ID:
00309406
Vues:
29
>Hi Sean,
>
>>I have solved my many DB connectivity problems and was wondering what function I would use to locate a character in a field and replace it with something else ie make smith,charles smith charles or something like that. TIA
>
>You have two choices, CHRTRAN() and STRTRAN().
>
>Chrtran() is faster because it only does searches for one character:
>

Actually, I believe that Dave Frankenbach found this not to be the case recently; the time on STRTRAN() was ~O(n) whereas CHRTRAN() ~O(n^2) on performing substitutions.

>lcText = chrtran('smith, charles', ',', '')
>
>returns "smith charles". It also replaces every found occurenece:
>
>lcText = chrtran('s,m,i,th, charles', ',', '')
>
>also returns "smith charles"
>
>Strtran() can find and replace whole strings with whole strings, look in the help for more info.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform