some solutions ommitted. > -- > yashi > > class String > def to_float > return to_f if self =~ /^[-+]?((\d+)?(\.\d+))|((\d+)(\.\d+)?)([eE][-+]\d+)?$/ > raise "fail at convert string to float" > end > def to_int > return to_i if self =~ /^[-+]?(\d+)$/ > raise "fail at convert string to int" > end > end This does not work for strings like foo124. this will not be converted althought one can argue that it could work. I'm no sure about this but I think it's cleaner not to work here. (But that's just my opinion YMMV) Regards Friedrich