Christopher Dicely <cmdicely / gmail.com> wrote:

> On Fri, Apr 11, 2008 at 9:20 AM, matt neuburg <matt / tidbits.com> wrote:
> > irb(main):001:0> s = "\\\\"
> >  => "\\\\"
> >  irb(main):002:0> s.length
> >  => 2
> >  irb(main):003:0> s = "howdy".sub("howdy", s)
> >  => "\\"
> >  irb(main):004:0> s.length
> >  => 1
> >
> >  So merely using a string as the second param of sub (the replacement
> >  value) can cause that string to be altered.
> 
> Nope, using the string (s) as the second parameter of sub did nothing to alter
> it. 

I didn't say that s was altered. I said that the string you provide as
the second param of sub might not be the string that gets substituted in
- as the example demonstrates. If you don't find this counterintuitive,
you don't; great. But some people might. Those are the people I'm trying
to help here. m.

-- 
matt neuburg, phd = matt / tidbits.com, http://www.tidbits.com/matt/
Leopard - http://www.takecontrolbooks.com/leopard-customizing.html
AppleScript - http://www.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com