diff --git a/src/LineReader.jl b/src/LineReader.jl index fa03d55..a39a404 100644 --- a/src/LineReader.jl +++ b/src/LineReader.jl @@ -21,6 +21,16 @@ function Base.getindex(l::Line, index::Int64) error("Index out of range") end +function Base.length(l::Line) + len = 0 + for (i,) in enumerate(l) + len += 1 + end + return len +end + +Base.lastindex(l::Line) = length(l) +Base.getindex(l::Line, I) = [l[i] for i in I] function find_delimiter(line::Bview, delimiter::UInt8, state::Int) # State refers to the last location we scanned @@ -55,4 +65,4 @@ end @inline function splitV(line::Sview, delimiter::Char) length(line) > 0 || error("Empty line given") return Line(line.data, UInt8(delimiter)) -end \ No newline at end of file +end