Project

General

Profile

Actions

Feature #10083

closed

String.to_i unexpected behavior

Added by josecastro (joseph castro) over 10 years ago. Updated over 10 years ago.

Status:
Rejected
Assignee:
Target version:
[ruby-core:63943]

Description

Hi

There's the issue:

"String".to_i  => 0  

This must be NIL or at least error, but no 0, because the string is not a number, also:

"10String".to_i => 10 

Is not 10, because "10String" is not a number, maybe is necessary a new method to get a number from any string, because to_i is to convert into a Integer and that should return an error.

Greetings everyone

Updated by nobu (Nobuyoshi Nakada) over 10 years ago

  • Description updated (diff)
  • Status changed from Open to Rejected

You can use Integer("String") instead.

Actions

Also available in: Atom PDF

Like0
Like0