From: "Michael W. Ryder" <_mwryder@...> Date: 2007-01-23T10:55:08+09:00 Subject: Re: Placing tabs in strings in irb Joel VanderWerf wrote: > Michael W. Ryder wrote: >> Is there any reason I cannot embed tabs in a string while using irb? >> I am trying to create a string using tabs to separate the various >> values for testing -- i.e. a = '1 2 3 4'. Using irb it >> either ignores the tab character or places a random value in the string. >> On a related note why is the value for the above string '1' if I use >> a.to_i to display it? I would have expected an error. > > If you *want* this to error, use > > irb(main):001:0> Integer("1 2") > ArgumentError: invalid value for Integer: "1 2" > from (irb):4:in `Integer' > from (irb):4 > Thanks for the tip. I had known about the to_i method and assumed that was the only way to do the conversion.