Skip to content

Commit

Permalink
Docs: add note about IOBuffer to countlines and eachline (Julia…
Browse files Browse the repository at this point in the history
  • Loading branch information
barucden authored and ElOceanografo committed May 4, 2021
1 parent 4e82b23 commit f01ec29
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions base/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,8 @@ retained. When called with a file name, the file is opened once at the beginning
iteration and closed at the end. If iteration is interrupted, the file will be
closed when the `EachLine` object is garbage collected.
To iterate over each line of a `String`, `eachline(IOBuffer(str))` can be used.
# Examples
```jldoctest
julia> open("my_file.txt", "w") do io
Expand Down Expand Up @@ -1157,6 +1159,8 @@ pass the filename as the first argument. EOL markers other than `'\\n'` are supp
passing them as the second argument. The last non-empty line of `io` is counted even if it does not
end with the EOL, matching the length returned by [`eachline`](@ref) and [`readlines`](@ref).
To count lines of a `String`, `countlines(IOBuffer(str))` can be used.
# Examples
```jldoctest
julia> io = IOBuffer("JuliaLang is a GitHub organization.\\n");
Expand Down

0 comments on commit f01ec29

Please sign in to comment.