Skip to content

Commit

Permalink
Allow boolean parsing of strings containing 0 and 1
Browse files Browse the repository at this point in the history
  • Loading branch information
kim366 committed Nov 11, 2018
1 parent 96ce5ba commit 16ea413
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions base/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ function tryparse_internal(::Type{Bool}, sbuff::Union{String,SubString{String}},
return nothing
end

if isnumeric(sbuff[1])
intres = tryparse_internal(UInt8, sbuff, startpos, endpos, base, false)
(intres == 1) && return true
(intres == 0) && return false
raise && throw(ArgumentError("invalid Bool representation: $(repr(sbuff))"))
end

orig_start = startpos
orig_end = endpos

Expand Down

0 comments on commit 16ea413

Please sign in to comment.