Yasushi Shoji wrote:
> 
> From: Friedrich Dominicus <Friedrich.Dominicus / inka.de>
> Subject: [ruby-talk:00989] a question about to_i
> Date: Sun, 19 Dec 1999 08:42:44 +0100
> 
> > Sorry, I'm quite new to ruby. But I encounterd the following problem. If
> > I have a string "bla" and apply to_i to it I get 0. This seems to be
> > quite strange because it is what it is a string so shouldn't an
> > exeception be rissen or s.th simular.
> 
> I think that's because if exception is rissen you can't do like
> following
> 
> s = 'whatever'
> t = '0492'
> u = 123
> 
> print s.to_i + t.to_i + u, "\n"

Now that is not a reason for me what about
print s.to_i * t.to_i + u, "\n" then it will give me 0 anyway, but that
won't help much and

what about print t.to_i / s.to_i? 

> 
> this gives you 615 no matter what s is
> 
> > And how do you check if a string is a number then?
> 
> so i guess you don't need any check.  but not sure that's what you want.

I need this check not in my example but I found it scary to just accept
that any String will turn into integer zero. 

Regards
Friedrich