xlate question
Kenneth Brody
kenbrody at bestweb.net
Fri Jan 21 06:28:12 PST 2005
Mike Schwartz-PC Support & Services wrote:
[...]
> > However, if the problem with commas [for which you could have used ","
> > rather than chr("34")] was because you didn't have quotes around the
> > field, then placing quotes around the field would eliminate the need
> > to eliminate the commas.
>
> I think you meant to say "used "," rather than chr("44")", Ken, or am I
> not reading something correctly?
Yes, that's what I meant.
> Actually what would be the correct (or best) syntax for replacing
> two characters within a field using just one xlate command? Suppose we
> wanted to replace the double quotes with a period and the commas with a
> tilde. Would this work:
>
> rep(15)=xlate(15,chr("34")&","),".~")
>
> I've never used xlate with multiple characters, and this might be
> something that everybody on the list should add to their arsenal of filePro
> knowledge...
That's exactly how xlate() works. Each character in the second parameter
is replaced with the corresponding character from the third parameter. If
the replacement string is shorter than the source string, then those
characters are removed from the result.
For example:
xlate(foo,"abc()","123")
This will replace "a" with "1", "b" with "2", "c" with "3", and remove any
parentheses.
--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:ThisIsASpamTrap at gmail.com>
More information about the Filepro-list
mailing list