From 1c6521b00f3ca46d57312503fcaf9e22682ca029 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 18 Sep 2020 00:31:47 -0700 Subject: [PATCH] closes https://github.com/JuliaData/Missings.jl/issues/61 parse and tryparse to handle missing/nothing, returning missing as result. --- base/parse.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/base/parse.jl b/base/parse.jl index 1097e8a19b804..e9be18af9bac2 100644 --- a/base/parse.jl +++ b/base/parse.jl @@ -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