# How to remove type when converting to string

**URL:** <https://discourse.julialang.org/t/how-to-remove-type-when-converting-to-string/79574>\
**Category:** General Usage\
**Tags:** question\
**Created:** [April 16, 2022, 2:41pm UTC](https://discourse.julialang.org/t/how-to-remove-type-when-converting-to-string/79574 "2022-04-16T14:41:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![XLVII](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xlvii/32/37099_2.png) [@XLVII](https://discourse.julialang.org/u/XLVII)\
**Post date:** [April 16, 2022, 2:41pm UTC](https://discourse.julialang.org/t/how-to-remove-type-when-converting-to-string/79574/1 "2022-04-16T14:41:35Z")

</div>

I want to convert this Any[1,2,3,4] to string but it gives “Any[1,2,3,4]”, it should give “[1,2,3,4]”

---

<div class="post-metadata">

**Author:** ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)\
**Post date:** [April 16, 2022, 3:38pm UTC](https://discourse.julialang.org/t/how-to-remove-type-when-converting-to-string/79574/2 "2022-04-16T15:38:36Z")

</div>

```julia
a = Any[1,2,3,4]
println(a)
println(convert(Vector{Int}, a))

```

yields

```julia
Any[1, 2, 3, 4]
[1, 2, 3, 4]

```

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [April 16, 2022, 4:20pm UTC](https://discourse.julialang.org/t/how-to-remove-type-when-converting-to-string/79574/3 "2022-04-16T16:20:16Z")

</div>

The larger question here is why this is a `Vector{Any}` and not a `Vector{Int}` from the start. Converting the whole array seem a little overkill just for printing. You could also easily do:

```julia
julia> a = Any[1, 2, 3, 4]
4-element Array{Any,1}:
 1
 2
 3
 4

julia> chop(string(a); head = 3, tail = 0)
"[1, 2, 3, 4]"

```
