Converting an array of string types

Hi all,
I am doing a small assignment project and this is the second time I am stuck. I have scrapped a website and got the data of the type stated below. Could some one please help me on how to convert the following array to an array of decimals?
a = [“96%”, “97%”, “97%”, “97%”, “93%”]

desired result

result = [9.6, 9.7, 9.7, 9.7, 9.3]

Thanks in advance.

not sure why you want 96% as 9.6 instead of 0.96 but here you go:

julia> a = Any["96%", "97%"]
2-element Array{Any,1}:
 "96%"
 "97%"

julia> f(x) = parse(Float64, x[1:end-1]) * 0.1
f (generic function with 1 method)

julia> f.(a)
2-element Array{Float64,1}:
 9.600000000000001
 9.700000000000001

key function is parse, the rest is just format cleaning and convert

4 Likes

Thanks a lot.