# Fastest way to parse a string of numbers

**URL:** <https://discourse.julialang.org/t/fastest-way-to-parse-a-string-of-numbers/16720>\
**Category:** General Usage\
**Tags:** question, parsing\
**Created:** [October 24, 2018, 8:23am UTC](https://discourse.julialang.org/t/fastest-way-to-parse-a-string-of-numbers/16720 "2018-10-24T08:23:09Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![quinnj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quinnj/32/11_2.png) [@quinnj](https://discourse.julialang.org/u/quinnj)\
**Post date:** [October 27, 2018, 3:46am UTC](https://discourse.julialang.org/t/fastest-way-to-parse-a-string-of-numbers/16720/4 "2018-10-27T03:46:10Z")

</div>

> [@jw3126](#):
>
> “1.0 2.34345 7.9”

The [Parsers.jl](https://github.com/JuliaData/Parsers.jl) package is setup to handle these kind of parsing scenarios quite well. In this case, you can do something like:

```julia
parser = Parsers.Delimited(" "; ignorerepeated=true)
io = IOBuffer("1.0 2.34345 7.9")
Parsers.parse(parser, io, Float64) # returns 1.0
Parsers.parse(parser, io, Float64) # returns 2.34345
Parsers.parse(parser, io, Float64) # returns 7.9

```

It’s a bit tricky to benchmark because it relies on parsing from an `IOBuffer`, but it’s also very fast because it’s making exactly one pass over the strings in parsing all three numbers.

Let me know if you have any questions or concerns.

---

_[View the full topic](https://discourse.julialang.org/t/fastest-way-to-parse-a-string-of-numbers/16720)._
