Remove leading zeros from string to int

Getting an integer from a string is parsing, so you should use parse:

julia> parse(Int64, "001")
1

In your case you’d have to combine it with passmissing as shown, so:

julia> passmissing(parse).(Int64, ["001", "012", missing, "002"])
4-element Vector{Union{Missing, Int64}}:
  1
 12
   missing
  2
3 Likes