I have a question:
I want to know the way to convert a ASCIIString represented number in an 
Array{ASCIIString, 1} into Int, and put it back into the original list as 
Array{Any, 1} in Julia.

For example:

When I have a array variable x as follows; 

julia> x = ["abc", "10"]
2-element Array{ASCIIString,1}:
 "abc"
 "10" 

and I want to get it converted as the following. 

julia> y = ["abc", 10 ]
2-element Array{Any,1}:
   "abc"
 10    

Then, if I've tried applying parse function and putting it back to the 
original Array, I ended up getting an error below.

x[2] = parse(Int, x[2])
ERROR: MethodError: `parse` has no method matching parse(::Type{Int64}, 
::Int64)
Closest candidates are:
  parse{T<:Integer}(::Type{T<:Integer}, !Matched::Char)
  parse{T<:Integer}(::Type{T<:Integer}, !Matched::Char, !Matched::Integer)
  parse{T<:Integer}(::Type{T<:Integer}, !Matched::AbstractString, 
!Matched::Integer)
  ...
 in convert at none:1
 in setindex! at array.jl:313

Can any one have a suggestion on the way to get an expected result?


Thanks in advance!!!

Masa



Reply via email to