Robert Dober
6/3/2007 11:45:00 AM
On 6/3/07, Sun Park <geniusleonid@gmail.com> wrote:
> Sorry, what I meant was :
>
> a = "abc"
> => "abc"
> a (some method with arguments of 1 and "d")
> => "adc"
>
> I wanted to find out are there any methods behaving like this.
Yes #[]=, what is wrong with it? Would you prefer a method with a
different name, I am not sure there is one.
Robert
>
>
>
> 2007/6/3, Robert Dober <robert.dober@gmail.com>:
> >
> > On 6/3/07, Sun Park <geniusleonid@gmail.com> wrote:
> > > Thanks :) do we have such method in String class, too?
> > irb(main):008:0> a='abc'
> > => "abc"
> > irb(main):009:0> a[1]=?a
> > => 97
> > irb(main):013:0> a[1..1]="a"
> > => "a"
> >
> > thus String#[]= is behaving differently from Array#[]=
> >
> > Cheers
> > Robert
> > You see things; and you say Why?
> > But I dream things that never were; and I say Why not?
> > -- George Bernard Shaw
> >
> >
>
--
You see things; and you say Why?
But I dream things that never were; and I say Why not?
-- George Bernard Shaw