From: Scott McGinness Date: 2013-03-13T05:30:06+09:00 Subject: Re: Confusion with Strings --e89a8f2346592f449204d7c027c8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12 March 2013 19:25, Love U Ruby wrote: > From the book I read a line about string : > > "If you try to set part of the string that doesn=E2=80=99t exist=E2=80=94= ***a too-high > or > too-low numerical index***, or a string or regular expression that > doesn=E2=80=99t match the string=E2=80=94you get a fatal error." > > Could you give one example against the line within ****? > > Thanks in advance. > > -- > Posted via http://www.ruby-forum.com/. > Do you know how to set any part of a string using a numerical index? For example, if I wrote the following in irb: >> s =3D "hello" =3D> "hello" could you set the "e" to "u", so that >> s =3D=3D "hullo" # =3D> true ? Once you can do that, try it with different numerical indices. --e89a8f2346592f449204d7c027c8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On 12 March 2013 19:25, Love U Ruby <= lists@ruby-forum.com> wrote:
From the book I read a line about string :

"If you try to set part of the string that doesn=E2=80=99t exist=E2=80= =94 ***a too-high
or
too-low numerical index***, or a string or regular expression that
doesn=E2=80=99t match the string=E2=80=94you get a fatal error."

Could you give one example against the line within ****?

Thanks in advance.

--
Posted via http://= www.ruby-forum.com/.

Do you know how to set any part of a string using a numerical index?=C2=A0=

For example, if I wrote the following in irb:
>> s =3D "hello"
=3D> "hello"

could you set the "e" to "u", so that
>> s =3D=3D "hullo" =C2=A0# =3D> = true
?

Once you can do that, try it with differen= t numerical indices.
--e89a8f2346592f449204d7c027c8--