# How to read in a list of integers into an array

**URL:** <https://discourse.julialang.org/t/how-to-read-in-a-list-of-integers-into-an-array/35185>\
**Category:** Statistics\
**Created:** [February 26, 2020, 6:06pm UTC](https://discourse.julialang.org/t/how-to-read-in-a-list-of-integers-into-an-array/35185 "2020-02-26T18:06:49Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [February 26, 2020, 9:46pm UTC](https://discourse.julialang.org/t/how-to-read-in-a-list-of-integers-into-an-array/35185/14 "2020-02-26T21:46:27Z")

</div>

Edit: Nvm this answer, see answer below.

~~Ah, I didn’t look at the sample file and didn’t notice you needed that big numbers. It probably makes sense to write your own little parser function then like~~

```julia
function read_data(s) 
    joined = join(split(s))
    no_brackets = SubString(joined, nextind(joined, 1), prevind(joined, lastindex(joined)))
    return parse.(BigInt, split(no_brackets, ','))
end

```

```julia
julia> read_data(s)
150-element Array{BigInt,1}:
                                                4
                                               12
                                               32
                                               80
                                              192
                                              448
                                             1024
                                             2304
                                             5120
                                            11264
                                            24576
                                            53248
                                           114688
                                           245760
                                           524288
                                          1114112
                                          2359296
                                          4980736
                                         10485760
                                         22020096
                                         46137344
                                         96468992
                                        201326592
                                        419430400
                                        872415232
                                                ⋮
        10803965149739796214962143785958640713728
        21778071482940061661655974875633165533184
        43896425332801061786775324358698099277824
...

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-read-in-a-list-of-integers-into-an-array/35185)._
