Skip to content

Commit

Permalink
Clarify behavior of strict for String-to-number conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil committed Nov 15, 2024
1 parent 6cec6a9 commit 75cc85b
Showing 1 changed file with 9 additions and 3 deletions.
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

0 comments on commit 75cc85b

Please sign in to comment.