Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Documentation for String#to_i(0) #76

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions string.c
Original file line number Diff line number Diff line change
Expand Up @@ -4995,10 +4995,12 @@ rb_str_include(VALUE str, VALUE arg)
* str.to_i(base=10) -> integer
*
* Returns the result of interpreting leading characters in <i>str</i> as an
* integer base <i>base</i> (between 2 and 36). Extraneous characters past the
* end of a valid number are ignored. If there is not a valid number at the
* start of <i>str</i>, <code>0</code> is returned. This method never raises an
* exception when <i>base</i> is valid.
* integer base <i>base</i> (either 0 or between 2 and 36). If a base of 0 is
* passed, radix indicators ('0b', '0o', '0d', '0x') at the beginning of the
* string will be honored. Extraneous characters past the end of a valid number
* are ignored. If there is not a valid number at the start of <i>str</i>,
* <code>0</code> is returned. This method never raises an exception when
* <i>base</i> is valid.
*
* "12345".to_i #=> 12345
* "99 red balloons".to_i #=> 99
Expand Down