From: Dmitry Buzdin Date: 2006-11-17T23:45:05+09:00 Subject: Re: Nuby question - printing substring as non-ASCII Then why not call to_i on a whole string? " 1 45.3456 ".to_i " 1 45.3456 ".to_f It will find the first number and convert it to Fixnum or Float. Dmitry Thomas Luedeke wrote: > I'm reading in a string of numbers, as follows: > > " 1 45.3456 " > > How do I write out the first non-whitespace element as a number? Ruby > wants to express as it in ASCII, and the .to_i method doesn't seem to > work on a substring. > > Thanks in advance. > > TPL > > -- > Posted via http://www.ruby-forum.com/.