@@ -277,13 +277,13 @@ julia> io = IOBuffer();
277277julia> write(io, "JuliaLang is a GitHub organization.", " It has many members.")
27827856
279279
280- julia> String(take !(io) )
280+ julia> takestring !(io)
281281"JuliaLang is a GitHub organization. It has many members."
282282
283283julia> write(io, "Sometimes those members") + write(io, " write documentation.")
28428444
285285
286- julia> String(take !(io) )
286+ julia> takestring !(io)
287287"Sometimes those members write documentation."
288288```
289289User-defined plain-data types without `write` methods can be written when wrapped in a `Ref`:
@@ -544,7 +544,7 @@ julia> rm("my_file.txt")
544544"""
545545readuntil (filename:: AbstractString , delim; kw... ) = open (io-> readuntil (io, delim; kw... ), convert (String, filename):: String )
546546readuntil (stream:: IO , delim:: UInt8 ; kw... ) = _unsafe_take! (copyuntil (IOBuffer (sizehint= 16 ), stream, delim; kw... ))
547- readuntil (stream:: IO , delim:: Union{AbstractChar, AbstractString} ; kw... ) = String ( _unsafe_take ! (copyuntil (IOBuffer (sizehint= 16 ), stream, delim; kw... ) ))
547+ readuntil (stream:: IO , delim:: Union{AbstractChar, AbstractString} ; kw... ) = takestring ! (copyuntil (IOBuffer (sizehint= 16 ), stream, delim; kw... ))
548548readuntil (stream:: IO , delim:: T ; keep:: Bool = false ) where T = _copyuntil (Vector {T} (), stream, delim, keep)
549549
550550
@@ -566,10 +566,10 @@ Similar to [`readuntil`](@ref), which returns a `String`; in contrast,
566566```jldoctest
567567julia> write("my_file.txt", "JuliaLang is a GitHub organization.\\ nIt has many members.\\ n");
568568
569- julia> String(take !(copyuntil(IOBuffer(), "my_file.txt", 'L') ))
569+ julia> takestring !(copyuntil(IOBuffer(), "my_file.txt", 'L'))
570570"Julia"
571571
572- julia> String(take !(copyuntil(IOBuffer(), "my_file.txt", '.', keep = true) ))
572+ julia> takestring !(copyuntil(IOBuffer(), "my_file.txt", '.', keep = true))
573573"JuliaLang is a GitHub organization."
574574
575575julia> rm("my_file.txt")
@@ -616,8 +616,7 @@ Logan
616616"""
617617readline (filename:: AbstractString ; keep:: Bool = false ) =
618618 open (io -> readline (io; keep), filename)
619- readline (s:: IO = stdin ; keep:: Bool = false ) =
620- String (_unsafe_take! (copyline (IOBuffer (sizehint= 16 ), s; keep)))
619+ readline (s:: IO = stdin ; keep:: Bool = false ) = takestring! (copyline (IOBuffer (sizehint= 16 ), s; keep))
621620
622621"""
623622 copyline(out::IO, io::IO=stdin; keep::Bool=false)
@@ -642,10 +641,10 @@ See also [`copyuntil`](@ref) for reading until more general delimiters.
642641```jldoctest
643642julia> write("my_file.txt", "JuliaLang is a GitHub organization.\\ nIt has many members.\\ n");
644643
645- julia> String(take !(copyline(IOBuffer(), "my_file.txt") ))
644+ julia> takestring !(copyline(IOBuffer(), "my_file.txt"))
646645"JuliaLang is a GitHub organization."
647646
648- julia> String(take !(copyline(IOBuffer(), "my_file.txt", keep=true) ))
647+ julia> takestring !(copyline(IOBuffer(), "my_file.txt", keep=true))
649648"JuliaLang is a GitHub organization.\\ n"
650649
651650julia> rm("my_file.txt")
@@ -1290,7 +1289,7 @@ function iterate(r::Iterators.Reverse{<:EachLine}, state)
12901289 buf. size = _stripnewline (r. itr. keep, buf. size, buf. data)
12911290 empty! (chunks) # will cause next iteration to terminate
12921291 seekend (r. itr. stream) # reposition to end of stream for isdone
1293- s = String ( _unsafe_take ! (buf) )
1292+ s = unsafe_takestring ! (buf)
12941293 else
12951294 # extract the string from chunks[ichunk][inewline+1] to chunks[jchunk][jnewline]
12961295 if ichunk == jchunk # common case: current and previous newline in same chunk
@@ -1307,7 +1306,7 @@ function iterate(r::Iterators.Reverse{<:EachLine}, state)
13071306 end
13081307 write (buf, view (chunks[jchunk], 1 : jnewline))
13091308 buf. size = _stripnewline (r. itr. keep, buf. size, buf. data)
1310- s = String ( _unsafe_take ! (buf) )
1309+ s = unsafe_takestring ! (buf)
13111310
13121311 # overwrite obsolete chunks (ichunk+1:jchunk)
13131312 i = jchunk
0 commit comments