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

Clarify behavior of strict for String-to-number conversions #15199

Open
wants to merge 1 commit into
base: master
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
12 changes: 9 additions & 3 deletions src/string.cr
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ class String
# * **whitespace**: if `true`, leading and trailing whitespaces are allowed
# * **underscore**: if `true`, underscores in numbers are allowed
# * **prefix**: if `true`, the prefixes `"0x"`, `"0o"` and `"0b"` override the base
# * **strict**: if `true`, extraneous characters past the end of the number are disallowed
# * **strict**: if `true`, extraneous characters past the end of the number
# are disallowed, unless **whitespace** is also `true` and all the trailing
# characters past the number are whitespaces
# * **leading_zero_is_octal**: if `true`, then a number prefixed with `"0"` will be treated as an octal
#
# ```
Expand Down Expand Up @@ -692,7 +694,9 @@ class String
#
# Options:
# * **whitespace**: if `true`, leading and trailing whitespaces are allowed
# * **strict**: if `true`, extraneous characters past the end of the number are disallowed
# * **strict**: if `true`, extraneous characters past the end of the number
# are disallowed, unless **whitespace** is also `true` and all the trailing
# characters past the number are whitespaces
#
# ```
# "123.45e1".to_f # => 1234.5
Expand All @@ -717,7 +721,9 @@ class String
#
# Options:
# * **whitespace**: if `true`, leading and trailing whitespaces are allowed
# * **strict**: if `true`, extraneous characters past the end of the number are disallowed
# * **strict**: if `true`, extraneous characters past the end of the number
# are disallowed, unless **whitespace** is also `true` and all the trailing
# characters past the number are whitespaces
#
# ```
# "123.45e1".to_f? # => 1234.5
Expand Down
Loading