Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
parse and tryparse to handle missing/nothing, returning missing as result.
  • Loading branch information
pepelovesvim authored Sep 18, 2020
1 parent d587f9d commit 1c6521b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions base/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ parse(::Type{T}, s::AbstractString; kwargs...) where T<:Real =
convert(T, tryparse_internal(T, s, true; kwargs...))
parse(::Type{T}, s::AbstractString) where T<:Complex =
convert(T, tryparse_internal(T, s, firstindex(s), lastindex(s), true))
parse(::Type{T}, s::Union{Missing, Nothing}) where T<:Number = missing

tryparse(T::Type{Complex{S}}, s::AbstractString) where S<:Real =
tryparse_internal(T, s, firstindex(s), lastindex(s), false)
tryparse(::Type{T}, s::Union{Missing, Nothing}) where T<:Number = missing

0 comments on commit 1c6521b

Please sign in to comment.