# Converting an array of string types

**URL:** https://discourse.julialang.org/t/converting-an-array-of-string-types/48262
**Category:** New to Julia
**Tags:** question
**Created:** [October 13, 2020, 12:00am UTC](https://discourse.julialang.org/t/converting-an-array-of-string-types/48262 "2020-10-13T00:00:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mausam614](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mausam614](https://discourse.julialang.org/u/mausam614)
#### Post date: [October 13, 2020, 12:00am UTC](https://discourse.julialang.org/t/converting-an-array-of-string-types/48262/1 "2020-10-13T00:00:18Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [October 13, 2020, 12:07am UTC](https://discourse.julialang.org/t/converting-an-array-of-string-types/48262/2 "2020-10-13T00:07:03Z")

</div>

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

```julia
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

---

<div class="post-metadata">

### Author: ![mausam614](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mausam614](https://discourse.julialang.org/u/mausam614)
#### Post date: [October 13, 2020, 2:17am UTC](https://discourse.julialang.org/t/converting-an-array-of-string-types/48262/3 "2020-10-13T02:17:44Z")

</div>

Thanks a lot.
