If you are sure that you can discard the digits after the decimal point (because they are always zeros), you can use split()
before parse()
:
julia> s = "20.0"; parse(Int, split(s, ".")[1])
20
julia> s = "20"; parse(Int, split(s, ".")[1])
20
If you are sure that you can discard the digits after the decimal point (because they are always zeros), you can use split()
before parse()
:
julia> s = "20.0"; parse(Int, split(s, ".")[1])
20
julia> s = "20"; parse(Int, split(s, ".")[1])
20