1. Re: Replacing characters (Matt: bug)

Andy,

That's funny (ha ha, not strange).   I often don't completely understand
exactly how to code stuff, I often just "try this, try that" until something
works, which may be why I set those variables as I did.  And the result of
that is finding out that your routine is more powerful than you thought.  :)
So if you make a string library, & include this routine, probably want to
make sure to describe how to make it do both single & multiple char replace?

Dan

----- Original Message -----
From: "Andy Serpa" <renegade at earthling.net>
To: "EUforum" <EUforum at topica.com>
Sent: Wednesday, September 18, 2002 5:35 PM
Subject: RE: Replacing characters (Matt: bug)


>
>
> Dan Moyer wrote:
> > Andy,
> >
> > Well, on the one hand it's your routine, so you should know, but on the
> > other hand, my test results show it does replace one with two.
>
> I should, but I'm not very sharp.
>
> >Maybe
> > there's something wrong with my test??  I'll send you another copy of
> > the
> > zip of the test I applied (previously sent twice to the forum), but
> > here's
> > the pertinent variables, & a copy of one line of the results (the fact
> > that
> > it says "Replace_in_string" instead of "replace_in_string" is just to
> > distinguish two different routines with the same name in the test, the
> > one
> > with "R" is yours):
> >
> >
> Sorry -- I read on the web interface, so the attachments don't come
> through.
>
> > <code snippet>
> > integer tr  -- test repetitions
> > sequence r, rb  -- replace, replace by
> > text = {}
> > new = {}
> > times = {}
> >
> > r = {')'}         -- replace
> > rb = {"ZZ"}   --replace by
> >
>
> There's the thing.  I was thinking that the arguments would always be
> one-dimensional strings, with the replacement always being a single
> element of that, i.e. one character.  You've got rb = {"ZZ"} instead of
> just rb = "ZZ" so in your test "ZZ" in a single element instead of just
> 'Z'. Your search string (r) however uses single quotes and is the same
> as r = ")".
>
> It is all clear now.
>
>
>
>

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu