I wrote the following function:
function string2range(string_range)
a, b, c = split(string_range, ':')
a1 = parse(Float64, a)
b1 = parse(Float64, b)
c1 = parse(Float64, c)
StepRangeLen(a1, b1, 1+Int64(round((c1-a1)/b1)))
end
Usage:
julia> string2range("1:0.5:5")
1.0:0.5:5.0
I use it to parse ranges defined in configuration files.
But is it implemented correctly?