Skip to content

tryparse for Char types #45640

@alecloudenback

Description

@alecloudenback
julia> Base.tryparse(Int,'1')
ERROR: MethodError: no method matching tryparse(::Type{Int64}, ::Char)
Closest candidates are:
  tryparse(::Type{T}, ::AbstractString; base) where T<:Integer at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/base/parse.jl:235

Is there a reason not to define such a method? Base.parse works:

julia> Base.parse(Int,'1')
1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions