Function tryparse to prevent errors when parsing strings in Julia
Code
julia> parse(Int64, "010101")
10101
julia> parse(Int64, "윈터의 생일은 010101")
ERROR: ArgumentError: invalid base 10 digit '윈' in "윈터의 생일은 010101"
Stacktrace:
[1] tryparse_internal(::Type{Int64}, s::String, startpos::Int64, endpos::Int64, base_::Int64, raise::Bool)
@ Base .\parse.jl:143
[2] #parse#472
@ .\parse.jl:254 [inlined]
[3] parse(::Type{Int64}, s::String)
@ Base .\parse.jl:253
[4] top-level scope
@ g:\admin\REPL.jl:2
julia> tryparse(Int64, "윈터의 생일은 010101")
tryparse(T, str) converts str to type T if possible, and returns nothing if it cannot. Because strings can take many odd forms, it is convenient for handling exceptions in such cases.
