Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replace more than one character at a time STRTRAN?
Message
From
04/05/2004 10:44:39
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00900695
Message ID:
00900746
Views:
23
Thanks for the clarification David. :o) Good to know.

Tracy

>Tracy,
>
>chrtran() is "normally" supposed to substitute one character for another.
>
>? chrtran( lcText, "ABC", "DEF" ) && change A to D, B to E and C to F
>
>An empty third argument allows all of the second argument characters to be removed. And I think this is how most calls to chrtran() are used.
>
>If your intput might contain other characters like - or () and you don't want to have to worry about all possible "bad" characers to filter out you can instead us a "good" character list with two chrtran calls:
>
>
lcGoodCharacters = "0123456789."
>? chrtran( lcText, chrtran( lcText, lcGoodCharacters, "" ), "" )
>
>
>the inner chrtran() gives out a list of all of the bad characters, that the outer chrtran() then removes from the string.
>
>>Thanks Sergey. I looked up CHRTRAN() in help, but I didn't see where it would replace more than one value. I missed that! I tested the same code using STRTRAN() and mvalue remained the same with no substitutions... That's my memory for ya! Useless! :o)
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform