Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replacing a character string with 0's - only if....
Message
 
 
À
13/12/2000 17:58:56
Erin Eby
Mission Critical Software
Gainesville, Floride, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00453144
Message ID:
00453278
Vues:
22
>hi all. it's the end of the day and i want to go home. please somebody help me!!! here's what i have:
>
>lc_variable = 123-456-7890
>
>i have a DO WHILE that runs through this variable and looks at each character. if the character is not = to a -, it replaces the character with a 0. for example, the first character is a 1, so it looks at that,
>sees it's not a -, and then attempts to replace it with a 0. i would like my end result to be 000-000-0000. but, i dont' know how to do the REPLACE part of the code. any clues?


The code below will replace any characters but "-" with "0"
lc_variable = "123-456-7890"
lcTemp = CHRTRAN(lc_variable, "-", "")
lcResult = CHRTRAN(lc_variable, lcTemp, REPLICATE("0", LEN(lcTemp)))
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform