From: Joanne Daudier Date: 2012-12-06T10:49:14+09:00 Subject: Re: Extract number (float) from string --_51f6e7ce-098d-4445-a17e-f3deeca60b5f_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I can't figure out how to unsubscribe. Help! Joanne > Date: Thu=2C 6 Dec 2012 10:44:12 +0900 > From: tamouse.lists@gmail.com > Subject: Re: Extract number (float) from string > To: ruby-talk@ruby-lang.org >=20 > On Tue=2C Dec 4=2C 2012 at 1:50 PM=2C 7stud -- wro= te: > > str.match(/[.\d]+/)[0].to_f >=20 > Interestingly=2C this works because of the way to_f interprets such thing= s as: >=20 > ".......".to_f # =3D> 0.0 > ".0.0.0.0.0.".to_f # =3D> 0.0 >=20 > both of which will also be caught by the regexp. >=20 = --_51f6e7ce-098d-4445-a17e-f3deeca60b5f_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I can't figure out how to unsubs= cribe.  =3BHelp!

Joanne


>=3B Date: Thu=2C = 6 Dec 2012 10:44:12 +0900
>=3B From: tamouse.lists@gmail.com
>=3B= Subject: Re: Extract number (float) from string
>=3B To: ruby-talk@ru= by-lang.org
>=3B
>=3B On Tue=2C Dec 4=2C 2012 at 1:50 PM=2C 7stu= d -- <=3Blists@ruby-forum.com>=3B wrote:
>=3B >=3B str.match(/= [.\d]+/)[0].to_f
>=3B
>=3B Interestingly=2C this works because o= f the way to_f interprets such things as:
>=3B
>=3B ".......".to= _f # =3D>=3B 0.0
>=3B ".0.0.0.0.0.".to_f # =3D>=3B 0.0
>=3B <= br>>=3B both of which will also be caught by the regexp.
>=3B

= --_51f6e7ce-098d-4445-a17e-f3deeca60b5f_--