# How to parse a string with ranges?

**URL:** <https://discourse.julialang.org/t/how-to-parse-a-string-with-ranges/97288>\
**Category:** General Usage\
**Tags:** strings, repl, parsing\
**Created:** [April 9, 2023, 10:30pm UTC](https://discourse.julialang.org/t/how-to-parse-a-string-with-ranges/97288 "2023-04-09T22:30:48Z")\
**Posts on this page:** 1\
**Showing post:** 7

<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 10, 2023, 1:18am UTC](https://discourse.julialang.org/t/how-to-parse-a-string-with-ranges/97288/7 "2023-04-10T01:18:09Z")

</div>

> ```julia
> julia> Base._colon(parse.(Int, split("3:3:12", ':'))...)
> 3:3:12
> 
> ```

This should not be the accepted answer. `_colon` is undocumented and underscore-prefixed, it should not be used in production code. A better solution (considering that is okay to throw an exception if the format is incorrect) is:

```julia
julia> (:)(parse.(Int, split("3:3:12", ':'))...)
3:3:12

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-parse-a-string-with-ranges/97288)._
