diff --git a/base/LineEdit.jl b/base/LineEdit.jl
index 3169537ceb9c0..4264658c6c226 100644
--- a/base/LineEdit.jl
+++ b/base/LineEdit.jl
@@ -64,7 +64,7 @@ type PromptState <: ModeState
indent::Int
end
-input_string(s::PromptState) = bytestring(s.input_buffer)
+input_string(s::PromptState) = String(s.input_buffer)
input_string_newlines(s::PromptState) = count(c->(c == '\n'), input_string(s))
function input_string_newlines_aftercursor(s::PromptState)
@@ -386,7 +386,7 @@ function edit_move_up(buf::IOBuffer)
npos = rsearch(buf.data, '\n', position(buf))
npos == 0 && return false # we're in the first line
# We're interested in character count, not byte count
- offset = length(bytestring(buf.data[(npos+1):(position(buf))]))
+ offset = length(String(buf.data[(npos+1):(position(buf))]))
npos2 = rsearch(buf.data, '\n', npos-1)
seek(buf, npos2)
for _ = 1:offset
@@ -407,7 +407,7 @@ end
function edit_move_down(buf::IOBuffer)
npos = rsearch(buf.data[1:buf.size], '\n', position(buf))
# We're interested in character count, not byte count
- offset = length(bytestring(buf.data[(npos+1):(position(buf))]))
+ offset = length(String(buf.data[(npos+1):(position(buf))]))
npos2 = search(buf.data[1:buf.size], '\n', position(buf)+1)
if npos2 == 0 #we're in the last line
return false
@@ -986,7 +986,7 @@ function history_set_backward(s::SearchState, backward)
s.backward = backward
end
-input_string(s::SearchState) = bytestring(s.query_buffer)
+input_string(s::SearchState) = String(s.query_buffer)
function reset_state(s::SearchState)
if s.query_buffer.size != 0
@@ -1035,7 +1035,7 @@ refresh_multi_line(termbuf::TerminalBuffer, terminal::UnixTerminal,
s::Union{PromptState,PrefixSearchState}) = s.ias =
refresh_multi_line(termbuf, terminal, buffer(s), s.ias, s, indent = s.indent)
-input_string(s::PrefixSearchState) = bytestring(s.response_buffer)
+input_string(s::PrefixSearchState) = String(s.response_buffer)
# a meta-prompt that presents itself as parent_prompt, but which has an independent keymap
# for prefix searching
@@ -1153,7 +1153,7 @@ function enter_prefix_search(s::MIState, p::PrefixHistoryPrompt, backward::Bool)
pss = state(s, p)
pss.parent = parent
pss.histprompt.parent_prompt = parent
- pss.prefix = bytestring(pointer(buf.data), position(buf))
+ pss.prefix = String(pointer(buf.data), position(buf))
copybuf!(pss.response_buffer, buf)
pss.indent = state(s, parent).indent
pss.mi = s
diff --git a/base/REPL.jl b/base/REPL.jl
index dcfd69f2e90e3..d5ac3865de569 100644
--- a/base/REPL.jl
+++ b/base/REPL.jl
@@ -271,10 +271,10 @@ end
immutable LatexCompletions <: CompletionProvider; end
-bytestring_beforecursor(buf::IOBuffer) = bytestring(buf.data[1:buf.ptr-1])
+beforecursor(buf::IOBuffer) = String(buf.data[1:buf.ptr-1])
function complete_line(c::REPLCompletionProvider, s)
- partial = bytestring_beforecursor(s.input_buffer)
+ partial = beforecursor(s.input_buffer)
full = LineEdit.input_string(s)
ret, range, should_complete = completions(full, endof(partial))
return ret, partial[range], should_complete
@@ -282,14 +282,14 @@ end
function complete_line(c::ShellCompletionProvider, s)
# First parse everything up to the current position
- partial = bytestring_beforecursor(s.input_buffer)
+ partial = beforecursor(s.input_buffer)
full = LineEdit.input_string(s)
ret, range, should_complete = shell_completions(full, endof(partial))
return ret, partial[range], should_complete
end
function complete_line(c::LatexCompletions, s)
- partial = bytestring_beforecursor(LineEdit.buffer(s))
+ partial = beforecursor(LineEdit.buffer(s))
full = LineEdit.input_string(s)
ret, range, should_complete = bslash_completions(full, endof(partial))[2]
return ret, partial[range], should_complete
@@ -383,7 +383,7 @@ function mode_idx(hist::REPLHistoryProvider, mode)
end
function add_history(hist::REPLHistoryProvider, s)
- str = rstrip(bytestring(s.input_buffer))
+ str = rstrip(String(s.input_buffer))
isempty(strip(str)) && return
mode = mode_idx(hist, LineEdit.mode(s))
!isempty(hist.history) &&
@@ -497,7 +497,7 @@ function history_move_prefix(s::LineEdit.PrefixSearchState,
prefix::AbstractString,
backwards::Bool,
cur_idx = hist.cur_idx)
- cur_response = bytestring(LineEdit.buffer(s))
+ cur_response = String(LineEdit.buffer(s))
# when searching forward, start at last_idx
if !backwards && hist.last_idx > 0
cur_idx = hist.last_idx
@@ -537,8 +537,8 @@ function history_search(hist::REPLHistoryProvider, query_buffer::IOBuffer, respo
qpos = position(query_buffer)
qpos > 0 || return true
- searchdata = bytestring_beforecursor(query_buffer)
- response_str = bytestring(response_buffer)
+ searchdata = beforecursor(query_buffer)
+ response_str = String(response_buffer)
# Alright, first try to see if the current match still works
a = position(response_buffer) + 1
@@ -589,7 +589,7 @@ const julia_green = "\033[1m\033[32m"
function return_callback(s)
ast = Base.syntax_deprecation_warnings(false) do
- Base.parse_input_line(bytestring(LineEdit.buffer(s)))
+ Base.parse_input_line(String(LineEdit.buffer(s)))
end
if !isa(ast, Expr) || (ast.head != :continue && ast.head != :incomplete)
return true
diff --git a/base/base.jl b/base/base.jl
index 3fac9efceb6a4..d2b1ae847ccb0 100644
--- a/base/base.jl
+++ b/base/base.jl
@@ -82,8 +82,6 @@ finalize(o::ANY) = ccall(:jl_finalize, Void, (Any,), o)
gc(full::Bool=true) = ccall(:jl_gc_collect, Void, (Cint,), full)
gc_enable(on::Bool) = ccall(:jl_gc_enable, Cint, (Cint,), on)!=0
-bytestring(str::String) = str
-
# used by { } syntax
function cell_1d(xs::ANY...)
n = length(xs)
diff --git a/base/c.jl b/base/c.jl
index a9309fd3373a7..db6d0e371544b 100644
--- a/base/c.jl
+++ b/base/c.jl
@@ -77,7 +77,7 @@ pointer(p::Cwstring) = convert(Ptr{Cwchar_t}, p)
pointer_to_string(p::Cstring, own::Bool=false) = pointer_to_string(convert(Ptr{UInt8}, p), own)
# convert strings to String etc. to pass as pointers
-cconvert(::Type{Cstring}, s::AbstractString) = bytestring(s)
+cconvert(::Type{Cstring}, s::AbstractString) = String(s)
cconvert(::Type{Cwstring}, s::AbstractString) = wstring(s)
containsnul(p::Ptr, len) = C_NULL != ccall(:memchr, Ptr{Cchar}, (Ptr{Cchar}, Cint, Csize_t), p, 0, len)
@@ -96,7 +96,7 @@ convert(::Type{Cstring}, s::Symbol) = Cstring(unsafe_convert(Ptr{Cchar}, s))
# FIXME: this should be handled by implicit conversion to Cwstring, but good luck with that
@windows_only function cwstring(s::AbstractString)
- bytes = bytestring(s).data
+ bytes = String(s).data
0 in bytes && throw(ArgumentError("embedded NULs are not allowed in C strings: $(repr(s))"))
return push!(utf8to16(bytes), 0)
end
diff --git a/base/client.jl b/base/client.jl
index e77b3de9aded6..5a2c065ae56d0 100644
--- a/base/client.jl
+++ b/base/client.jl
@@ -165,7 +165,7 @@ function parse_input_line(s::String; filename::String="none")
ccall(:jl_parse_input_line, Any, (Ptr{UInt8}, Csize_t, Ptr{UInt8}, Csize_t),
s, sizeof(s), filename, sizeof(filename))
end
-parse_input_line(s::AbstractString) = parse_input_line(bytestring(s))
+parse_input_line(s::AbstractString) = parse_input_line(String(s))
function parse_input_line(io::IO)
s = ""
@@ -218,7 +218,7 @@ function process_options(opts::JLOptions)
# startup worker
if opts.worker != C_NULL
- start_worker(bytestring(opts.worker)) # does not return
+ start_worker(String(opts.worker)) # does not return
end
# add processors
if opts.nprocs > 0
@@ -226,30 +226,30 @@ function process_options(opts::JLOptions)
end
# load processes from machine file
if opts.machinefile != C_NULL
- addprocs(load_machine_file(bytestring(opts.machinefile)))
+ addprocs(load_machine_file(String(opts.machinefile)))
end
# load file immediately on all processors
if opts.load != C_NULL
@sync for p in procs()
- @async remotecall_fetch(include, p, bytestring(opts.load))
+ @async remotecall_fetch(include, p, String(opts.load))
end
end
# eval expression
if opts.eval != C_NULL
repl = false
- eval(Main, parse_input_line(bytestring(opts.eval)))
+ eval(Main, parse_input_line(String(opts.eval)))
break
end
# eval expression and show result
if opts.print != C_NULL
repl = false
- show(eval(Main, parse_input_line(bytestring(opts.print))))
+ show(eval(Main, parse_input_line(String(opts.print))))
println()
break
end
# eval expression but don't disable interactive mode
if opts.postboot != C_NULL
- eval(Main, parse_input_line(bytestring(opts.postboot)))
+ eval(Main, parse_input_line(String(opts.postboot)))
end
# load file
if !isempty(ARGS) && !isempty(ARGS[1])
diff --git a/base/dSFMT.jl b/base/dSFMT.jl
index 2b4def10bbdc3..95fdf8fe02e07 100644
--- a/base/dSFMT.jl
+++ b/base/dSFMT.jl
@@ -29,7 +29,7 @@ function dsfmt_get_idstring()
idstring = ccall((:dsfmt_get_idstring,:libdSFMT),
Ptr{UInt8},
())
- return bytestring(idstring)
+ return String(idstring)
end
function dsfmt_get_min_array_size()
diff --git a/base/datafmt.jl b/base/datafmt.jl
index 0186f2f6c70b0..8dc6f0bc6bb56 100644
--- a/base/datafmt.jl
+++ b/base/datafmt.jl
@@ -51,7 +51,7 @@ function readdlm_auto(input, dlm::Char, T::Type, eol::Char, auto::Bool; opts...)
input = readstring(input)
end
end
- sinp = isa(input, Vector{UInt8}) ? bytestring(input) :
+ sinp = isa(input, Vector{UInt8}) ? String(input) :
isa(input, IO) ? readstring(input) :
input
readdlm_string(sinp, dlm, T, eol, auto, optsd)
diff --git a/base/deprecated.jl b/base/deprecated.jl
index c20488ecc6796..6e5a882f1c6fa 100644
--- a/base/deprecated.jl
+++ b/base/deprecated.jl
@@ -60,7 +60,7 @@ function depwarn(msg, funcsym)
opts = JLOptions()
if opts.depwarn > 0
ln = Int(unsafe_load(cglobal(:jl_lineno, Cint)))
- fn = bytestring(unsafe_load(cglobal(:jl_filename, Ptr{Cchar})))
+ fn = String(unsafe_load(cglobal(:jl_filename, Ptr{Cchar})))
bt = backtrace()
caller = firstcaller(bt, funcsym)
if opts.depwarn == 1 # raise a warning
@@ -1160,10 +1160,17 @@ end
@deprecate_binding UTF8String String
@deprecate_binding ByteString String
-@deprecate ascii(p::Ptr{UInt8}, len::Integer) ascii(bytestring(p, len))
-@deprecate ascii(p::Ptr{UInt8}) ascii(bytestring(p))
+@deprecate ascii(p::Ptr{UInt8}, len::Integer) ascii(String(p, len))
+@deprecate ascii(p::Ptr{UInt8}) ascii(String(p))
@deprecate ascii(x) ascii(string(x))
+@deprecate bytestring(s::Cstring) String(s)
+@deprecate bytestring(v::Vector{UInt8}) String(v)
+@deprecate bytestring(io::Base.AbstractIOBuffer) String(io)
+@deprecate bytestring(p::Union{Ptr{Int8},Ptr{UInt8}}) String(p)
+@deprecate bytestring(p::Union{Ptr{Int8},Ptr{UInt8}}, len::Integer) String(p,len)
+@deprecate bytestring(s::AbstractString...) string(s...)
+
@deprecate ==(x::Char, y::Integer) UInt32(x) == y
@deprecate ==(x::Integer, y::Char) x == UInt32(y)
@deprecate isless(x::Char, y::Integer) UInt32(x) < y
diff --git a/base/dict.jl b/base/dict.jl
index 4ac15aeaebba4..c7c7401f7fe58 100644
--- a/base/dict.jl
+++ b/base/dict.jl
@@ -52,9 +52,9 @@ function _truncate_at_width_or_chars(str, width, chars="", truncmark="…")
lastidx != 0 && str[lastidx] in chars && (lastidx = prevind(str, lastidx))
truncidx == 0 && (truncidx = lastidx)
if lastidx < endof(str)
- return bytestring(SubString(str, 1, truncidx) * truncmark)
+ return String(SubString(str, 1, truncidx) * truncmark)
else
- return bytestring(str)
+ return String(str)
end
end
diff --git a/base/docs/helpdb/Base.jl b/base/docs/helpdb/Base.jl
index 480d57f73e2c5..412daf429e2f2 100644
--- a/base/docs/helpdb/Base.jl
+++ b/base/docs/helpdb/Base.jl
@@ -9705,22 +9705,6 @@ modified by the current file creation mask.
"""
mkdir
-"""
- bytestring(::Ptr{UInt8}, [length])
-
-Create a string from the address of a C (0-terminated) string encoded in ASCII or UTF-8. A
-copy is made; the ptr can be safely freed. If `length` is specified, the string does not
-have to be 0-terminated.
-"""
-bytestring(::Ptr{UInt8},?)
-
-"""
- bytestring(s)
-
-Convert a string to a contiguous byte array representation appropriate for passing it to C
-functions. The string will be encoded as either ASCII or UTF-8.
-"""
-bytestring(s)
"""
midpoints(e)
diff --git a/base/env.jl b/base/env.jl
index e5b263dd64c56..bc0482c2e0702 100644
--- a/base/env.jl
+++ b/base/env.jl
@@ -7,7 +7,7 @@ _hasenv(s::AbstractString) = _getenv(s) != C_NULL
function access_env(onError::Function, var::AbstractString)
val = _getenv(var)
- val == C_NULL ? onError(var) : bytestring(val)
+ val == C_NULL ? onError(var) : String(val)
end
function _setenv(var::AbstractString, val::AbstractString, overwrite::Bool=true)
diff --git a/base/exports.jl b/base/exports.jl
index d91c00e367817..d0810e0e9d814 100644
--- a/base/exports.jl
+++ b/base/exports.jl
@@ -811,7 +811,6 @@ export
bin,
bits,
bytes2hex,
- bytestring,
charwidth,
chomp,
chop,
diff --git a/base/fft/FFTW.jl b/base/fft/FFTW.jl
index 3cf93af66a241..27408e71e6a61 100644
--- a/base/fft/FFTW.jl
+++ b/base/fft/FFTW.jl
@@ -20,7 +20,7 @@ export export_wisdom, import_wisdom, import_system_wisdom, forget_wisdom,
const libfftw = Base.libfftw_name
const libfftwf = Base.libfftwf_name
-const version = convert(VersionNumber, split(bytestring(cglobal((:fftw_version,Base.DFT.FFTW.libfftw), UInt8)), ['-', ' '])[2])
+const version = convert(VersionNumber, split(String(cglobal((:fftw_version,Base.DFT.FFTW.libfftw), UInt8)), ['-', ' '])[2])
## Direction of FFT
diff --git a/base/file.jl b/base/file.jl
index fb06bd6aa7f74..e38b1814973dc 100644
--- a/base/file.jl
+++ b/base/file.jl
@@ -32,7 +32,7 @@ function pwd()
b = Array(UInt8,1024)
len = Ref{Csize_t}(length(b))
uv_error(:getcwd, ccall(:uv_cwd, Cint, (Ptr{UInt8}, Ptr{Csize_t}), b, len))
- bytestring(b[1:len[]])
+ String(b[1:len[]])
end
function cd(dir::AbstractString)
@@ -187,7 +187,7 @@ function tempname()
d = get(ENV, "TMPDIR", C_NULL) # tempnam ignores TMPDIR on darwin
p = ccall(:tempnam, Cstring, (Cstring,Cstring), d, :julia)
systemerror(:tempnam, p == C_NULL)
- s = bytestring(p)
+ s = String(p)
Libc.free(p)
return s
end
@@ -208,7 +208,7 @@ function mktempdir(parent=tempdir())
b = joinpath(parent, "tmpXXXXXX")
p = ccall(:mkdtemp, Cstring, (Cstring,), b)
systemerror(:mktempdir, p == C_NULL)
- return bytestring(p)
+ return String(p)
end
end
@@ -293,7 +293,7 @@ function readdir(path::AbstractString)
entries = String[]
ent = Ref{uv_dirent_t}()
while Base.UV_EOF != ccall(:uv_fs_scandir_next, Cint, (Ptr{Void}, Ptr{uv_dirent_t}), uv_readdir_req, ent)
- push!(entries, bytestring(ent[].name))
+ push!(entries, String(ent[].name))
end
# Clean up the request string
@@ -430,7 +430,7 @@ function readlink(path::AbstractString)
uv_error("readlink", ret)
assert(false)
end
- tgt = bytestring(ccall(:jl_uv_fs_t_ptr, Ptr{Cchar}, (Ptr{Void}, ), req))
+ tgt = String(ccall(:jl_uv_fs_t_ptr, Ptr{Cchar}, (Ptr{Void}, ), req))
ccall(:uv_fs_req_cleanup, Void, (Ptr{Void}, ), req)
return tgt
finally
diff --git a/base/gmp.jl b/base/gmp.jl
index a786d622d27aa..b5edee0436f5a 100644
--- a/base/gmp.jl
+++ b/base/gmp.jl
@@ -19,7 +19,7 @@ else
end
typealias CdoubleMax Union{Float16, Float32, Float64}
-gmp_version() = VersionNumber(bytestring(unsafe_load(cglobal((:__gmp_version, :libgmp), Ptr{Cchar}))))
+gmp_version() = VersionNumber(String(unsafe_load(cglobal((:__gmp_version, :libgmp), Ptr{Cchar}))))
gmp_bits_per_limb() = Int(unsafe_load(cglobal((:__gmp_bits_per_limb, :libgmp), Cint)))
const GMP_VERSION = gmp_version()
@@ -84,8 +84,8 @@ convert(::Type{BigInt}, x::BigInt) = x
function tryparse_internal(::Type{BigInt}, s::AbstractString, startpos::Int, endpos::Int, base::Int, raise::Bool)
_n = Nullable{BigInt}()
- # don't make a copy in the common case where we are parsing a whole bytestring
- bstr = startpos == start(s) && endpos == endof(s) ? bytestring(s) : bytestring(SubString(s,startpos,endpos))
+ # don't make a copy in the common case where we are parsing a whole String
+ bstr = startpos == start(s) && endpos == endof(s) ? String(s) : String(SubString(s,startpos,endpos))
sgn, base, i = Base.parseint_preamble(true,base,bstr,start(bstr),endof(bstr))
if i == 0
diff --git a/base/hashing2.jl b/base/hashing2.jl
index 10ee4a9073877..714cbb59d44fc 100644
--- a/base/hashing2.jl
+++ b/base/hashing2.jl
@@ -178,4 +178,4 @@ function hash(s::Union{String,SubString{String}}, h::UInt)
# note: use pointer(s) here (see #6058).
ccall(memhash, UInt, (Ptr{UInt8}, Csize_t, UInt32), pointer(s), sizeof(s), h % UInt32) + h
end
-hash(s::AbstractString, h::UInt) = hash(bytestring(s), h)
+hash(s::AbstractString, h::UInt) = hash(String(s), h)
diff --git a/base/initdefs.jl b/base/initdefs.jl
index 0cee012d00043..359df57b4ef11 100644
--- a/base/initdefs.jl
+++ b/base/initdefs.jl
@@ -49,7 +49,7 @@ end
function init_bind_addr()
opts = JLOptions()
if opts.bindto != C_NULL
- bind_to = split(bytestring(opts.bindto), ":")
+ bind_to = split(String(opts.bindto), ":")
bind_addr = string(parse(IPAddr, bind_to[1]))
if length(bind_to) > 1
bind_port = parse(Int,bind_to[2])
diff --git a/base/interactiveutil.jl b/base/interactiveutil.jl
index 553aab4238237..45a9c2776def4 100644
--- a/base/interactiveutil.jl
+++ b/base/interactiveutil.jl
@@ -205,7 +205,7 @@ function versioninfo(io::IO=STDOUT, verbose::Bool=false)
if verbose
println(io, "Environment:")
for (k,v) in ENV
- if !is(match(r"JULIA|PATH|FLAG|^TERM$|HOME", bytestring(k)), nothing)
+ if !is(match(r"JULIA|PATH|FLAG|^TERM$|HOME", String(k)), nothing)
println(io, " $(k) = $(v)")
end
end
diff --git a/base/iobuffer.jl b/base/iobuffer.jl
index a1609ca96c4a1..a24d3a41c5946 100644
--- a/base/iobuffer.jl
+++ b/base/iobuffer.jl
@@ -216,9 +216,9 @@ end
isopen(io::AbstractIOBuffer) = io.readable || io.writable || io.seekable || nb_available(io) > 0
-function bytestring(io::AbstractIOBuffer)
- io.readable || throw(ArgumentError("bytestring read failed, IOBuffer is not readable"))
- io.seekable || throw(ArgumentError("bytestring read failed, IOBuffer is not seekable"))
+function String(io::AbstractIOBuffer)
+ io.readable || throw(ArgumentError("IOBuffer is not readable"))
+ io.seekable || throw(ArgumentError("IOBuffer is not seekable"))
return String(copy!(Array(UInt8, io.size), 1, io.data, 1, io.size))
end
diff --git a/base/libc.jl b/base/libc.jl
index c061d8f52aba6..6585e4753f1f3 100644
--- a/base/libc.jl
+++ b/base/libc.jl
@@ -148,7 +148,7 @@ function strftime(fmt::AbstractString, tm::TmStruct)
if n == 0
return ""
end
- bytestring(pointer(timestr), n)
+ String(pointer(timestr), n)
end
"""
@@ -205,7 +205,7 @@ function gethostname()
@unix_only err=ccall(:gethostname, Int32, (Ptr{UInt8}, UInt), hn, length(hn))
@windows_only err=ccall(:gethostname, stdcall, Int32, (Ptr{UInt8}, UInt32), hn, length(hn))
systemerror("gethostname", err != 0)
- bytestring(pointer(hn))
+ String(pointer(hn))
end
## system error handling ##
@@ -228,7 +228,7 @@ errno(e::Integer) = ccall(:jl_set_errno, Void, (Cint,), e)
Convert a system call error code to a descriptive string
"""
-strerror(e::Integer) = bytestring(ccall(:strerror, Cstring, (Int32,), e))
+strerror(e::Integer) = String(ccall(:strerror, Cstring, (Int32,), e))
strerror() = strerror(errno())
"""
diff --git a/base/libdl.jl b/base/libdl.jl
index 30d70e3745bc5..6730d3b90f5d8 100644
--- a/base/libdl.jl
+++ b/base/libdl.jl
@@ -142,7 +142,7 @@ find_library(libname::Union{Symbol,AbstractString}, extrapaths=String[]) =
function dlpath(handle::Ptr{Void})
p = ccall(:jl_pathname_for_handle, Cstring, (Ptr{Void},), handle)
- s = bytestring(p)
+ s = String(p)
@windows_only Libc.free(p)
return s
end
@@ -188,7 +188,7 @@ dlext
# This callback function called by dl_iterate_phdr() on Linux
function dl_phdr_info_callback(di::dl_phdr_info, size::Csize_t, dynamic_libraries::Array{AbstractString,1})
# Skip over objects without a path (as they represent this own object)
- name = bytestring(di.name)
+ name = String(di.name)
if !isempty(name)
push!(dynamic_libraries, name)
end
@@ -210,7 +210,7 @@ function dllist()
# start at 1 instead of 0 to skip self
for i in 1:numImages-1
- name = bytestring(ccall(:_dyld_get_image_name, Cstring, (UInt32,), i))
+ name = String(ccall(:_dyld_get_image_name, Cstring, (UInt32,), i))
push!(dynamic_libraries, name)
end
end
diff --git a/base/libgit2.jl b/base/libgit2.jl
index 27a60b5f64d89..cada5eae0e7f5 100644
--- a/base/libgit2.jl
+++ b/base/libgit2.jl
@@ -107,7 +107,7 @@ function diff_files(repo::GitRepo, branch1::AbstractString, branch2::AbstractStr
delta = diff[i]
delta === nothing && break
if delta.status in filter
- push!(files, bytestring(delta.new_file.path))
+ push!(files, String(delta.new_file.path))
end
end
finalize(diff)
@@ -297,7 +297,7 @@ function clone{P<:AbstractPayload}(repo_url::AbstractString, repo_path::Abstract
remote_cb::Ptr{Void} = C_NULL,
payload::Nullable{P}=Nullable{AbstractPayload}())
# setup clone options
- lbranch = Base.cconvert(Cstring, bytestring(branch))
+ lbranch = Base.cconvert(Cstring, String(branch))
fetch_opts=FetchOptions(callbacks = RemoteCallbacks(credentials_cb(), payload))
clone_opts = CloneOptions(
bare = Cint(isbare),
@@ -337,7 +337,7 @@ function cat{T<:GitObject}(repo::GitRepo, ::Type{T}, object::AbstractString)
obj = get(T, repo, obj_id)
if isa(obj, GitBlob)
- return bytestring(convert(Ptr{UInt8}, content(obj)))
+ return String(convert(Ptr{UInt8}, content(obj)))
else
return nothing
end
diff --git a/base/libgit2/callbacks.jl b/base/libgit2/callbacks.jl
index f4dcb7ab2fbe5..fe30b7e59a44c 100644
--- a/base/libgit2/callbacks.jl
+++ b/base/libgit2/callbacks.jl
@@ -15,7 +15,7 @@ function mirror_callback(remote::Ptr{Ptr{Void}}, repo_ptr::Ptr{Void},
# And set the configuration option to true for the push command
config = GitConfig(GitRepo(repo_ptr))
- name_str = bytestring(name)
+ name_str = String(name)
err= try set!(config, "remote.$name_str.mirror", true)
catch -1
finally finalize(config)
@@ -36,7 +36,7 @@ function credentials_callback(cred::Ptr{Ptr{Void}}, url_ptr::Cstring,
username_ptr::Cstring,
allowed_types::Cuint, payload_ptr::Ptr{Void})
err = 1
- url = bytestring(url_ptr)
+ url = String(url_ptr)
if isset(allowed_types, Cuint(Consts.CREDTYPE_USERPASS_PLAINTEXT))
username = userpass = ""
@@ -74,7 +74,7 @@ function credentials_callback(cred::Ptr{Ptr{Void}}, url_ptr::Cstring,
username = if username_ptr == Cstring_NULL
prompt("Username for '$url'")
else
- bytestring(username_ptr)
+ String(username_ptr)
end
publickey = if "SSH_PUB_KEY" in keys(ENV)
@@ -105,7 +105,7 @@ end
function fetchhead_foreach_callback(ref_name::Cstring, remote_url::Cstring,
oid::Ptr{Oid}, is_merge::Cuint, payload::Ptr{Void})
fhead_vec = unsafe_pointer_to_objref(payload)::Vector{FetchHead}
- push!(fhead_vec, FetchHead(bytestring(ref_name), bytestring(remote_url), Oid(oid), is_merge == 1))
+ push!(fhead_vec, FetchHead(String(ref_name), String(remote_url), Oid(oid), is_merge == 1))
return Cint(0)
end
diff --git a/base/libgit2/commit.jl b/base/libgit2/commit.jl
index 0db602552d2d8..6681e1f9ca75d 100644
--- a/base/libgit2/commit.jl
+++ b/base/libgit2/commit.jl
@@ -7,7 +7,7 @@ function message(c::GitCommit, raw::Bool=false)
if msg_ptr == Cstring_NULL
return nothing
end
- return bytestring(msg_ptr)
+ return String(msg_ptr)
end
function author(c::GitCommit)
diff --git a/base/libgit2/config.jl b/base/libgit2/config.jl
index b8aa0b33b2c34..981e401f5ba73 100644
--- a/base/libgit2/config.jl
+++ b/base/libgit2/config.jl
@@ -56,7 +56,7 @@ function get{T<:AbstractString}(::Type{T}, c::GitConfig, name::AbstractString)
@check ccall((:git_config_get_string_buf, :libgit2), Cint,
(Ptr{Buffer}, Ptr{Void}, Cstring), buf_ptr, c.ptr, name)
return with(buf_ptr[]) do buf
- bytestring(buf.ptr, buf.size)
+ String(buf.ptr, buf.size)
end
end
diff --git a/base/libgit2/error.jl b/base/libgit2/error.jl
index e40733e73314b..876093c561663 100644
--- a/base/libgit2/error.jl
+++ b/base/libgit2/error.jl
@@ -74,7 +74,7 @@ function last_error()
if err != C_NULL
err_obj = unsafe_load(err)
err_class = Class[err_obj.class][]
- err_msg = bytestring(err_obj.message)
+ err_msg = String(err_obj.message)
else
err_class = Class[0][]
err_msg = "No errors"
diff --git a/base/libgit2/oid.jl b/base/libgit2/oid.jl
index d23fcd11ce156..816be5f800ef1 100644
--- a/base/libgit2/oid.jl
+++ b/base/libgit2/oid.jl
@@ -20,7 +20,7 @@ function Oid(id::Array{UInt8,1})
end
function Oid(id::AbstractString)
- bstr = bytestring(id)
+ bstr = String(id)
len = sizeof(bstr)
oid_ptr = Ref(Oid())
err = if len < OID_HEXSZ
diff --git a/base/libgit2/reference.jl b/base/libgit2/reference.jl
index 518c964d9e453..a42352e60cdde 100644
--- a/base/libgit2/reference.jl
+++ b/base/libgit2/reference.jl
@@ -29,7 +29,7 @@ function shortname(ref::GitReference)
isempty(ref) && return ""
name_ptr = ccall((:git_reference_shorthand, :libgit2), Cstring, (Ptr{Void},), ref.ptr)
name_ptr == C_NULL && return ""
- return bytestring(name_ptr)
+ return String(name_ptr)
end
function reftype(ref::GitReference)
@@ -41,14 +41,14 @@ function fullname(ref::GitReference)
reftype(ref) == Consts.REF_OID && return ""
rname = ccall((:git_reference_symbolic_target, :libgit2), Cstring, (Ptr{Void},), ref.ptr)
rname == C_NULL && return ""
- return bytestring(rname)
+ return String(rname)
end
function name(ref::GitReference)
isempty(ref) && return ""
name_ptr = ccall((:git_reference_name, :libgit2), Cstring, (Ptr{Void},), ref.ptr)
name_ptr == C_NULL && return ""
- return bytestring(name_ptr)
+ return String(name_ptr)
end
function branch(ref::GitReference)
@@ -56,7 +56,7 @@ function branch(ref::GitReference)
str_ptr_ptr = Ref(LibGit2.Cstring_NULL)
@check ccall((:git_branch_name, :libgit2), Cint,
(Ptr{Cstring}, Ptr{Void},), str_ptr_ptr, ref.ptr)
- return bytestring(str_ptr_ptr[])
+ return String(str_ptr_ptr[])
end
function ishead(ref::GitReference)
diff --git a/base/libgit2/remote.jl b/base/libgit2/remote.jl
index 7dba24240a793..c1d61217bc4f3 100644
--- a/base/libgit2/remote.jl
+++ b/base/libgit2/remote.jl
@@ -35,7 +35,7 @@ end
function url(rmt::GitRemote)
url_ptr = ccall((:git_remote_url, :libgit2), Cstring, (Ptr{Void}, ), rmt.ptr)
url_ptr == Cstring_NULL && return ""
- return bytestring(url_ptr)
+ return String(url_ptr)
end
function fetch_refspecs(rmt::GitRemote)
diff --git a/base/libgit2/repository.jl b/base/libgit2/repository.jl
index 2a52114e12b5e..2f4f9d2fb343c 100644
--- a/base/libgit2/repository.jl
+++ b/base/libgit2/repository.jl
@@ -116,8 +116,8 @@ function get{T <: GitObject}(::Type{T}, r::GitRepo, oid::AbstractString)
end
function gitdir(repo::GitRepo)
- return bytestring(ccall((:git_repository_path, :libgit2), Cstring,
- (Ptr{Void},), repo.ptr))
+ return String(ccall((:git_repository_path, :libgit2), Cstring,
+ (Ptr{Void},), repo.ptr))
end
function path(repo::GitRepo)
diff --git a/base/libgit2/signature.jl b/base/libgit2/signature.jl
index 41931daad0c12..85b13959f0ed0 100644
--- a/base/libgit2/signature.jl
+++ b/base/libgit2/signature.jl
@@ -2,8 +2,8 @@
function Signature(ptr::Ptr{SignatureStruct})
sig = unsafe_load(ptr)::SignatureStruct
- name = bytestring(sig.name)
- email = bytestring(sig.email)
+ name = String(sig.name)
+ email = String(sig.email)
time = sig.when.time
offset = sig.when.offset
return Signature(name, email, time, offset)
diff --git a/base/libgit2/strarray.jl b/base/libgit2/strarray.jl
index aa1483980d45d..162fab21efcc8 100644
--- a/base/libgit2/strarray.jl
+++ b/base/libgit2/strarray.jl
@@ -2,11 +2,11 @@
function StrArrayStruct{T<:AbstractString}(strs::T...)
strcount = length(strs)
- map(s->Base.unsafe_convert(Cstring, bytestring(s)), strs) # check for null-strings
+ map(s->Base.unsafe_convert(Cstring, String(s)), strs) # check for null-strings
sa_strings = convert(Ptr{Cstring}, Libc.malloc(sizeof(Cstring) * strcount))
for i=1:strcount
len = length(strs[i])
- in_ptr = pointer(bytestring(strs[i]))
+ in_ptr = pointer(String(strs[i]))
out_ptr = convert(Ptr{UInt8}, Libc.malloc(sizeof(UInt8) * (len + 1)))
unsafe_copy!(out_ptr, in_ptr, len)
unsafe_store!(out_ptr, zero(UInt8), len + 1) # NULL byte
@@ -19,7 +19,7 @@ StrArrayStruct{T<:AbstractString}(strs::Vector{T}) = StrArrayStruct(strs...)
function Base.convert(::Type{Vector{AbstractString}}, sa::StrArrayStruct)
arr = Array(AbstractString, sa.count)
for i=1:sa.count
- arr[i] = bytestring(unsafe_load(sa.strings, i))
+ arr[i] = String(unsafe_load(sa.strings, i))
end
return arr
end
diff --git a/base/libgit2/tag.jl b/base/libgit2/tag.jl
index efaeb5feb1e57..83b822ea85a2f 100644
--- a/base/libgit2/tag.jl
+++ b/base/libgit2/tag.jl
@@ -31,7 +31,7 @@ function tag_create(repo::GitRepo, tag::AbstractString, commit::Union{AbstractSt
end
function name(tag::GitTag)
- return bytestring(ccall((:git_tag_name, :libgit2), Cstring, (Ptr{Void}, ), tag.ptr))
+ return String(ccall((:git_tag_name, :libgit2), Cstring, (Ptr{Void}, ), tag.ptr))
end
function target(tag::GitTag)
diff --git a/base/libgit2/tree.jl b/base/libgit2/tree.jl
index a8bf387b5be3d..ace746a0a2b01 100644
--- a/base/libgit2/tree.jl
+++ b/base/libgit2/tree.jl
@@ -18,7 +18,7 @@ end
function filename(te::GitTreeEntry)
str = ccall((:git_tree_entry_name, :libgit2), Cstring, (Ptr{Void},), te.ptr)
- str != C_NULL && return bytestring(str)
+ str != C_NULL && return String(str)
return nothing
end
diff --git a/base/libgit2/utils.jl b/base/libgit2/utils.jl
index b0c841b902e90..d780eb14eba9e 100644
--- a/base/libgit2/utils.jl
+++ b/base/libgit2/utils.jl
@@ -14,7 +14,7 @@ isset(val::Integer, flag::Integer) = (val & flag == flag)
function prompt(msg::AbstractString; default::AbstractString="", password::Bool=false)
msg = !isempty(default) ? msg*" [$default]:" : msg*":"
uinput = if password
- bytestring(ccall(:getpass, Cstring, (Cstring,), msg))
+ String(ccall(:getpass, Cstring, (Cstring,), msg))
else
print(msg)
chomp(readline(STDIN))
diff --git a/base/libuv.jl b/base/libuv.jl
index 7d2264fac0678..2b8603c382a72 100644
--- a/base/libuv.jl
+++ b/base/libuv.jl
@@ -59,9 +59,9 @@ type UVError <: Exception
UVError(p::AbstractString,code::Integer)=new(p,code)
end
-struverror(err::Int32) = bytestring(ccall(:uv_strerror,Cstring,(Int32,),err))
+struverror(err::Int32) = String(ccall(:uv_strerror,Cstring,(Int32,),err))
struverror(err::UVError) = struverror(err.code)
-uverrorname(err::Int32) = bytestring(ccall(:uv_err_name,Cstring,(Int32,),err))
+uverrorname(err::Int32) = String(ccall(:uv_err_name,Cstring,(Int32,),err))
uverrorname(err::UVError) = uverrorname(err.code)
uv_error(prefix::Symbol, c::Integer) = uv_error(string(prefix),c)
diff --git a/base/loading.jl b/base/loading.jl
index 1325530f6991e..689ee46c2cdce 100644
--- a/base/loading.jl
+++ b/base/loading.jl
@@ -44,7 +44,7 @@ elseif OS_NAME == :Darwin
# getattrpath(path, &attr_list, &buf, sizeof(buf), FSOPT_NOFOLLOW);
function isfile_casesensitive(path)
isfile(path) || return false
- path_basename = bytestring(basename(path))
+ path_basename = String(basename(path))
local casepreserved_basename
const header_size = 12
buf = Array(UInt8, length(path_basename) + header_size + 1)
@@ -111,7 +111,7 @@ function find_in_path(name::String, wd)
end
return nothing
end
-find_in_path(name::AbstractString, wd = pwd()) = find_in_path(bytestring(name), wd)
+find_in_path(name::AbstractString, wd = pwd()) = find_in_path(String(name), wd)
function find_in_node_path(name::String, srcpath, node::Int=1)
if myid() == node
@@ -382,7 +382,7 @@ include_string(txt::String, fname::String) =
txt, sizeof(txt), fname, sizeof(fname))
include_string(txt::AbstractString, fname::AbstractString="string") =
- include_string(bytestring(txt), bytestring(fname))
+ include_string(String(txt), String(fname))
function source_path(default::Union{AbstractString,Void}="")
t = current_task()
@@ -525,7 +525,7 @@ function cache_dependencies(f::IO)
while true
n = ntoh(read(f, Int32))
n == 0 && break
- push!(files, (bytestring(read(f, n)), ntoh(read(f, Float64))))
+ push!(files, (String(read(f, n)), ntoh(read(f, Float64))))
end
return modules, files
end
diff --git a/base/mpfr.jl b/base/mpfr.jl
index dc75bf1b737fd..e00681e16e9a2 100644
--- a/base/mpfr.jl
+++ b/base/mpfr.jl
@@ -861,7 +861,7 @@ function string(x::BigFloat)
buf = Array(UInt8, lng + 1)
lng = ccall((:mpfr_snprintf,:libmpfr), Int32, (Ptr{UInt8}, Culong, Ptr{UInt8}, Ptr{BigFloat}...), buf, lng + 1, "%.Re", &x)
end
- return bytestring(pointer(buf), (1 <= x < 10 || -10 < x <= -1 || x == 0) ? lng - 4 : lng)
+ return String(pointer(buf), (1 <= x < 10 || -10 < x <= -1 || x == 0) ? lng - 4 : lng)
end
print(io::IO, b::BigFloat) = print(io, string(b))
diff --git a/base/multimedia.jl b/base/multimedia.jl
index 9c159a10ec6e1..b28e36efbb412 100644
--- a/base/multimedia.jl
+++ b/base/multimedia.jl
@@ -61,7 +61,7 @@ macro textmime(mime)
quote
mimeT = MIME{Symbol($mime)}
# avoid method ambiguities with the general definitions below:
- # (Q: should we treat Vector{UInt8} as a bytestring?)
+ # (Q: should we treat Vector{UInt8} as a String?)
Base.Multimedia.reprmime(m::mimeT, x::Vector{UInt8}) = sprint(writemime, m, x)
Base.Multimedia.stringmime(m::mimeT, x::Vector{UInt8}) = reprmime(m, x)
diff --git a/base/options.jl b/base/options.jl
index 3c000138b1f30..6f39c481d1900 100644
--- a/base/options.jl
+++ b/base/options.jl
@@ -45,7 +45,7 @@ function show(io::IO, opt::JLOptions)
for (i,f) in enumerate(fieldnames(opt))
v = getfield(opt,f)
if isa(v, Ptr{UInt8})
- v = v != C_NULL ? bytestring(v) : ""
+ v = v != C_NULL ? String(v) : ""
end
println(io, " ", f, " = ", repr(v), i < nfields ? "," : "")
end
diff --git a/base/parse.jl b/base/parse.jl
index bebff90d82fac..1970126449870 100644
--- a/base/parse.jl
+++ b/base/parse.jl
@@ -153,7 +153,7 @@ tryparse(::Type{Float64}, s::SubString{String}) = ccall(:jl_try_substrtod, Nulla
tryparse(::Type{Float32}, s::String) = ccall(:jl_try_substrtof, Nullable{Float32}, (Ptr{UInt8},Csize_t,Csize_t), s, 0, sizeof(s))
tryparse(::Type{Float32}, s::SubString{String}) = ccall(:jl_try_substrtof, Nullable{Float32}, (Ptr{UInt8},Csize_t,Csize_t), s.string, s.offset, s.endof)
-tryparse{T<:Union{Float32,Float64}}(::Type{T}, s::AbstractString) = tryparse(T, bytestring(s))
+tryparse{T<:Union{Float32,Float64}}(::Type{T}, s::AbstractString) = tryparse(T, String(s))
function parse{T<:AbstractFloat}(::Type{T}, s::AbstractString)
nf = tryparse(T, s)
@@ -169,7 +169,7 @@ float{S<:AbstractString}(a::AbstractArray{S}) = map!(float, similar(a,typeof(flo
function parse(str::AbstractString, pos::Int; greedy::Bool=true, raise::Bool=true)
# pos is one based byte offset.
# returns (expr, end_pos). expr is () in case of parse error.
- bstr = bytestring(str)
+ bstr = String(str)
ex, pos = ccall(:jl_parse_string, Any,
(Ptr{UInt8}, Csize_t, Int32, Int32),
bstr, sizeof(bstr), pos-1, greedy ? 1:0)
diff --git a/base/path.jl b/base/path.jl
index 4d54561f6a842..93c7f8e73929c 100644
--- a/base/path.jl
+++ b/base/path.jl
@@ -37,7 +37,7 @@ end
function splitdrive(path::AbstractString)
m = match(r"^(\w+:|\\\\\w+\\\w+|\\\\\?\\UNC\\\w+\\\w+|\\\\\?\\\w+:|)(.*)$", path)
- bytestring(m.captures[1]), bytestring(m.captures[2])
+ String(m.captures[1]), String(m.captures[2])
end
homedir() = get(ENV,"HOME",string(ENV["HOMEDRIVE"],ENV["HOMEPATH"]))
end
@@ -50,9 +50,9 @@ function splitdir(path::String)
m = match(path_dir_splitter,b)
m === nothing && return (a,b)
a = string(a, isempty(m.captures[1]) ? m.captures[2][1] : m.captures[1])
- a, bytestring(m.captures[3])
+ a, String(m.captures[3])
end
-splitdir(path::AbstractString) = splitdir(bytestring(path))
+splitdir(path::AbstractString) = splitdir(String(path))
dirname(path::AbstractString) = splitdir(path)[1]
basename(path::AbstractString) = splitdir(path)[2]
@@ -61,7 +61,7 @@ function splitext(path::AbstractString)
a, b = splitdrive(path)
m = match(path_ext_splitter, b)
m === nothing && return (path,"")
- a*m.captures[1], bytestring(m.captures[2])
+ a*m.captures[1], String(m.captures[2])
end
function pathsep(paths::AbstractString...)
@@ -155,7 +155,7 @@ end
@unix_only function realpath(path::AbstractString)
p = ccall(:realpath, Ptr{UInt8}, (Cstring, Ptr{UInt8}), path, C_NULL)
systemerror(:realpath, p == C_NULL)
- s = bytestring(p)
+ s = String(p)
Libc.free(p)
return s
end
diff --git a/base/pcre.jl b/base/pcre.jl
index 1ee3904119f04..670f618f62bfc 100644
--- a/base/pcre.jl
+++ b/base/pcre.jl
@@ -123,7 +123,7 @@ function err_message(errno)
buffer = Array(UInt8, 256)
ccall((:pcre2_get_error_message_8, PCRE_LIB), Void,
(Int32, Ptr{UInt8}, Csize_t), errno, buffer, sizeof(buffer))
- bytestring(pointer(buffer))
+ String(pointer(buffer))
end
function exec(re,subject,offset,options,match_data)
@@ -176,7 +176,7 @@ function capture_names(re)
idx = (high_byte << 8) | low_byte
# The capture group name is a null-terminated string located directly
# after the index.
- names[idx] = bytestring(nametable_ptr+offset+1)
+ names[idx] = String(nametable_ptr+offset+1)
end
names
end
diff --git a/base/pointer.jl b/base/pointer.jl
index 97d3bed9ff613..268db2d8d7999 100644
--- a/base/pointer.jl
+++ b/base/pointer.jl
@@ -27,8 +27,8 @@ unsafe_convert(::Type{Ptr{Int8}}, x::Symbol) = ccall(:jl_symbol_name, Ptr{Int8},
unsafe_convert(::Type{Ptr{UInt8}}, s::String) = unsafe_convert(Ptr{UInt8}, s.data)
unsafe_convert(::Type{Ptr{Int8}}, s::String) = convert(Ptr{Int8}, unsafe_convert(Ptr{UInt8}, s.data))
# convert strings to String etc. to pass as pointers
-cconvert(::Type{Ptr{UInt8}}, s::AbstractString) = bytestring(s)
-cconvert(::Type{Ptr{Int8}}, s::AbstractString) = bytestring(s)
+cconvert(::Type{Ptr{UInt8}}, s::AbstractString) = String(s)
+cconvert(::Type{Ptr{Int8}}, s::AbstractString) = String(s)
unsafe_convert{T}(::Type{Ptr{T}}, a::Array{T}) = ccall(:jl_array_ptr, Ptr{T}, (Any,), a)
unsafe_convert{S,T}(::Type{Ptr{S}}, a::AbstractArray{T}) = convert(Ptr{S}, unsafe_convert(Ptr{T}, a))
@@ -59,7 +59,7 @@ unsafe_store!(p::Ptr{Any}, x::ANY, i::Integer) = pointerset(p, x, Int(i))
unsafe_store!{T}(p::Ptr{T}, x, i::Integer) = pointerset(p, convert(T,x), Int(i))
unsafe_store!{T}(p::Ptr{T}, x) = pointerset(p, convert(T,x), 1)
-# unsafe pointer to string conversions (don't make a copy, unlike bytestring)
+# unsafe pointer to string conversions (don't make a copy, unlike String)
function pointer_to_string(p::Ptr{UInt8}, len::Integer, own::Bool=false)
a = ccall(:jl_ptr_to_array_1d, Vector{UInt8},
(Any, Ptr{UInt8}, Csize_t, Cint), Vector{UInt8}, p, len, own)
diff --git a/base/poll.jl b/base/poll.jl
index a61b7fe338b2b..cb5658eeb6dec 100644
--- a/base/poll.jl
+++ b/base/poll.jl
@@ -216,7 +216,7 @@ end
function uv_fseventscb(handle::Ptr{Void}, filename::Ptr, events::Int32, status::Int32)
t = @handle_as handle FileMonitor
- fname = filename == C_NULL ? "" : bytestring(convert(Ptr{UInt8}, filename))
+ fname = filename == C_NULL ? "" : String(convert(Ptr{UInt8}, filename))
if status != 0
notify_error(t.notify, UVError("FileMonitor", status))
else
diff --git a/base/precompile.jl b/base/precompile.jl
index 00e48982dbdcf..a9f6935a6abcd 100644
--- a/base/precompile.jl
+++ b/base/precompile.jl
@@ -174,7 +174,7 @@ precompile(Base.async_run_thunk, (Function,))
precompile(Base.atexit, (Function,))
precompile(Base.banner, (Base.Terminals.TTYTerminal,))
precompile(Base.startswith, (String, String))
-precompile(Base.bytestring, (String,))
+precompile(Base.String, (String,))
precompile(Base.chop, (String,))
precompile(Base.close, (Base.TTY,))
precompile(Base.close, (IOStream,))
diff --git a/base/printf.jl b/base/printf.jl
index 448b845fc869d..7800883b0dfe9 100644
--- a/base/printf.jl
+++ b/base/printf.jl
@@ -674,7 +674,7 @@ function gen_p(flags::String, width::Int, precision::Int, c::Char)
end
push!(blk.args, :(write(out, '0')))
push!(blk.args, :(write(out, 'x')))
- push!(blk.args, :(write(out, bytestring(hex(unsigned($x), $ptrwidth)))))
+ push!(blk.args, :(write(out, String(hex(unsigned($x), $ptrwidth)))))
if width > 0 && '-' in flags
push!(blk.args, pad(width, width, ' '))
end
diff --git a/base/process.jl b/base/process.jl
index b5f97b1f65ba7..fba0997615526 100644
--- a/base/process.jl
+++ b/base/process.jl
@@ -209,13 +209,13 @@ Mark a command object so that it will be run in a new process group, allowing it
"""
detach(cmd::Cmd) = Cmd(cmd; detach=true)
-# like bytestring(s), but throw an error if s contains NUL, since
+# like String(s), but throw an error if s contains NUL, since
# libuv requires NUL-terminated strings
function cstr(s)
if Base.containsnul(s)
throw(ArgumentError("strings containing NUL cannot be passed to spawned processes"))
end
- return bytestring(s)
+ return String(s)
end
# convert various env representations into an array of "key=val" strings
@@ -584,7 +584,7 @@ function read(cmd::AbstractCmd, stdin::Redirectable=DevNull)
end
function readstring(cmd::AbstractCmd, stdin::Redirectable=DevNull)
- return bytestring(read(cmd, stdin))
+ return String(read(cmd, stdin))
end
function writeall(cmd::AbstractCmd, stdin::AbstractString, stdout::Redirectable=DevNull)
@@ -702,7 +702,7 @@ function arg_gen(head, tail...)
tail = arg_gen(tail...)
vals = String[]
for h = head, t = tail
- push!(vals, cstr(bytestring(h, t)))
+ push!(vals, cstr(string(h,t)))
end
vals
end
diff --git a/base/regex.jl b/base/regex.jl
index e723d2d40c626..fd2eb708a9b64 100644
--- a/base/regex.jl
+++ b/base/regex.jl
@@ -18,7 +18,7 @@ type Regex
function Regex(pattern::AbstractString, compile_options::Integer,
match_options::Integer)
- pattern = bytestring(pattern)
+ pattern = String(pattern)
compile_options = UInt32(compile_options)
match_options = UInt32(match_options)
if (compile_options & ~PCRE.COMPILE_MASK) != 0
@@ -143,7 +143,7 @@ getindex(m::RegexMatch, name::AbstractString) = m[Symbol(name)]
function ismatch(r::Regex, s::AbstractString, offset::Integer=0)
compile(r)
- return PCRE.exec(r.regex, bytestring(s), offset, r.match_options,
+ return PCRE.exec(r.regex, String(s), offset, r.match_options,
r.match_data)
end
@@ -171,8 +171,9 @@ function match(re::Regex, str::Union{SubString{String}, String}, idx::Integer, a
end
match(r::Regex, s::AbstractString) = match(r, s, start(s))
-match(r::Regex, s::AbstractString, i::Integer) =
- throw(ArgumentError("regex matching is only available for bytestrings; use bytestring(s) to convert"))
+match(r::Regex, s::AbstractString, i::Integer) = throw(ArgumentError(
+ "regex matching is only available for the String type; use String(s) to convert"
+))
function matchall(re::Regex, str::String, overlap::Bool=false)
regex = compile(re).regex
@@ -220,8 +221,9 @@ function search(str::Union{String,SubString}, re::Regex, idx::Integer)
PCRE.exec(re.regex, str, idx-1, opts, re.match_data) ?
((Int(re.ovec[1])+1):prevind(str,Int(re.ovec[2])+1)) : (0:-1)
end
-search(s::AbstractString, r::Regex, idx::Integer) =
- throw(ArgumentError("regex search is only available for bytestrings; use bytestring(s) to convert"))
+search(s::AbstractString, r::Regex, idx::Integer) = throw(ArgumentError(
+ "regex search is only available for the String type; use String(s) to convert"
+))
search(s::AbstractString, r::Regex) = search(s,r,start(s))
immutable SubstitutionString{T<:AbstractString} <: AbstractString
diff --git a/base/require.jl b/base/require.jl
index 759ee3470f1c0..1b2f648894488 100644
--- a/base/require.jl
+++ b/base/require.jl
@@ -35,7 +35,7 @@ package_locks = Dict{String,Any}()
# only broadcast top-level (not nested) requires and reloads
toplevel_load = true
-require(fname::AbstractString) = require(bytestring(fname))
+require(fname::AbstractString) = require(String(fname))
require(f::AbstractString, fs::AbstractString...) = (require(f); for x in fs require(x); end)
function require(name::String)
diff --git a/base/sparse/csparse.jl b/base/sparse/csparse.jl
index 53a153c8aa77b..ab037530dbcbe 100644
--- a/base/sparse/csparse.jl
+++ b/base/sparse/csparse.jl
@@ -175,4 +175,4 @@ function symperm{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, pinv::Vector{Ti})
end
end
(C.').' # double transpose to order the columns
-end
\ No newline at end of file
+end
diff --git a/base/strings/basic.jl b/base/strings/basic.jl
index 7a2ac99e8fa3a..2d7869f61df53 100644
--- a/base/strings/basic.jl
+++ b/base/strings/basic.jl
@@ -10,24 +10,44 @@ next(s::AbstractString, i::Integer) = next(s,Int(i))
string() = ""
string(s::AbstractString) = s
-bytestring() = ""
-bytestring(s::Vector{UInt8}) =
+"""
+ String(s::AbstractString)
+
+Convert a string to a contiguous byte array representation encoded as UTF-8 bytes.
+This representation is often appropriate for passing strings to C.
+"""
+String(s::AbstractString) = print_to_string(s)
+String(s::String) = s
+
+"""
+ String(v::Vector{UInt8})
+
+Wrap a vector of bytes encoding string data as UTF-8 in a `String` object.
+The resulting `String` object takes ownership of the array.
+"""
+String(s::Vector{UInt8}) =
ccall(:jl_pchar_to_string, Ref{String}, (Ptr{UInt8},Int), s, length(s))
-function bytestring(p::Union{Ptr{UInt8},Ptr{Int8}})
- p == C_NULL && throw(ArgumentError("cannot convert NULL to string"))
- ccall(:jl_cstr_to_string, Ref{String}, (Cstring,), p)
-end
-bytestring(s::Cstring) = bytestring(convert(Ptr{UInt8}, s))
+"""
+ String(p::Ptr{UInt8}, [length::Integer])
-function bytestring(p::Union{Ptr{UInt8},Ptr{Int8}},len::Integer)
+Create a string from the address of a C (0-terminated) string encoded as UTF-8.
+A copy is made so the ptr can be safely freed. If `length` is specified, the string
+does not have to be 0-terminated.
+"""
+function String(p::Union{Ptr{UInt8},Ptr{Int8}}, len::Integer)
p == C_NULL && throw(ArgumentError("cannot convert NULL to string"))
ccall(:jl_pchar_to_string, Ref{String}, (Ptr{UInt8},Int), p, len)
end
+function String(p::Union{Ptr{UInt8},Ptr{Int8}})
+ p == C_NULL && throw(ArgumentError("cannot convert NULL to string"))
+ ccall(:jl_cstr_to_string, Ref{String}, (Cstring,), p)
+end
+String(s::Cstring) = String(convert(Ptr{UInt8}, s))
-convert(::Type{Vector{UInt8}}, s::AbstractString) = bytestring(s).data
-convert(::Type{Array{UInt8}}, s::AbstractString) = bytestring(s).data
-convert(::Type{String}, s::AbstractString) = bytestring(s)
+convert(::Type{Vector{UInt8}}, s::AbstractString) = String(s).data
+convert(::Type{Array{UInt8}}, s::AbstractString) = String(s).data
+convert(::Type{String}, s::AbstractString) = String(s)
convert(::Type{Vector{Char}}, s::AbstractString) = collect(s)
convert(::Type{Symbol}, s::AbstractString) = Symbol(s)
@@ -42,7 +62,7 @@ getindex{T<:Integer}(s::AbstractString, r::UnitRange{T}) = s[Int(first(r)):Int(l
getindex(s::AbstractString, v::AbstractVector) =
sprint(length(v), io->(for i in v; write(io,s[i]) end))
-Symbol(s::AbstractString) = Symbol(bytestring(s))
+Symbol(s::AbstractString) = Symbol(String(s))
sizeof(s::AbstractString) = error("type $(typeof(s)) has no canonical binary representation")
diff --git a/base/strings/io.jl b/base/strings/io.jl
index 9d10c74ffaf58..f6622340c8c03 100644
--- a/base/strings/io.jl
+++ b/base/strings/io.jl
@@ -37,7 +37,7 @@ function sprint(size::Integer, f::Function, args...; env=nothing)
else
f(s, args...)
end
- bytestring(resize!(s.data, s.size))
+ String(resize!(s.data, s.size))
end
sprint(f::Function, args...) = sprint(0, f, args...)
@@ -67,7 +67,6 @@ end
string_with_env(env, xs...) = print_to_string(xs...; env=env)
string(xs...) = print_to_string(xs...)
-bytestring(s::AbstractString...) = print_to_string(s...)
print(io::IO, s::AbstractString) = (write(io, s); nothing)
write(io::IO, s::AbstractString) = (len = 0; for c in s; len += write(io, c); end; len)
diff --git a/base/strings/types.jl b/base/strings/types.jl
index 6253f00deeb31..0ef383f104bd8 100644
--- a/base/strings/types.jl
+++ b/base/strings/types.jl
@@ -75,7 +75,8 @@ prevind(s::SubString, i::Integer) = prevind(s.string, i+s.offset)-s.offset
convert{T<:AbstractString}(::Type{SubString{T}}, s::T) = SubString(s, 1, endof(s))
-bytestring(p::SubString{String}) = bytestring(p.string.data[1+p.offset:p.offset+nextind(p, p.endof)-1])
+String(p::SubString{String}) =
+ String(p.string.data[1+p.offset:p.offset+nextind(p, p.endof)-1])
function getindex(s::AbstractString, r::UnitRange{Int})
checkbounds(s, r) || throw(BoundsError(s, r))
diff --git a/base/strings/util.jl b/base/strings/util.jl
index 38c2cd9e5f82b..e3d70ba3634dc 100644
--- a/base/strings/util.jl
+++ b/base/strings/util.jl
@@ -96,12 +96,12 @@ function lpad(s::AbstractString, n::Integer, p::AbstractString=" ")
if m <= 0; return s; end
l = strwidth(p)
if l==1
- return bytestring(p^m * s)
+ return String(p^m * s)
end
q = div(m,l)
r = m - q*l
i = r != 0 ? chr2ind(p, r) : -1
- bytestring(p^q*p[1:i]*s)
+ String(p^q*p[1:i]*s)
end
function rpad(s::AbstractString, n::Integer, p::AbstractString=" ")
@@ -109,12 +109,12 @@ function rpad(s::AbstractString, n::Integer, p::AbstractString=" ")
if m <= 0; return s; end
l = strwidth(p)
if l==1
- return bytestring(s * p^m)
+ return String(s * p^m)
end
q = div(m,l)
r = m - q*l
i = r != 0 ? chr2ind(p, r) : -1
- bytestring(s*p^q*p[1:i])
+ String(s*p^q*p[1:i])
end
lpad(s, n::Integer, p=" ") = lpad(string(s),n,string(p))
@@ -207,7 +207,7 @@ function replace(str::String, pattern, repl, limit::Integer)
write(out, SubString(str,i))
takebuf_string(out)
end
-replace(s::AbstractString, pat, f, n::Integer) = replace(bytestring(s), pat, f, n)
+replace(s::AbstractString, pat, f, n::Integer) = replace(String(s), pat, f, n)
replace(s::AbstractString, pat, r) = replace(s, pat, r, 0)
# hex <-> bytes conversion
diff --git a/base/sysinfo.jl b/base/sysinfo.jl
index c1acd96a06c09..9fb2dfeabe50b 100644
--- a/base/sysinfo.jl
+++ b/base/sysinfo.jl
@@ -57,7 +57,7 @@ type CPUinfo
cpu_times!irq::UInt64
CPUinfo(model,speed,u,n,s,id,ir)=new(model,speed,u,n,s,id,ir)
end
-CPUinfo(info::UV_cpu_info_t) = CPUinfo(bytestring(info.model), info.speed,
+CPUinfo(info::UV_cpu_info_t) = CPUinfo(String(info.model), info.speed,
info.cpu_times!user, info.cpu_times!nice, info.cpu_times!sys,
info.cpu_times!idle, info.cpu_times!irq)
@@ -148,7 +148,7 @@ function get_process_title()
buf = zeros(UInt8, 512)
err = ccall(:uv_get_process_title, Cint, (Ptr{UInt8}, Cint), buf, 512)
uv_error("get_process_title", err)
- return bytestring(pointer(buf))
+ return String(pointer(buf))
end
function set_process_title(title::AbstractString)
err = ccall(:uv_set_process_title, Cint, (Cstring,), title)
diff --git a/base/unicode/utf8proc.jl b/base/unicode/utf8proc.jl
index 64c0aab7773d9..c6ce45a6d0481 100644
--- a/base/unicode/utf8proc.jl
+++ b/base/unicode/utf8proc.jl
@@ -73,12 +73,12 @@ function utf8proc_map(s::String, flags::Integer)
result = ccall(:utf8proc_map, Cssize_t,
(Ptr{UInt8}, Cssize_t, Ref{Ptr{UInt8}}, Cint),
s, sizeof(s), p, flags)
- result < 0 && error(bytestring(ccall(:utf8proc_errmsg, Cstring,
+ result < 0 && error(String(ccall(:utf8proc_errmsg, Cstring,
(Cssize_t,), result)))
pointer_to_string(p[], result, true)::String
end
-utf8proc_map(s::AbstractString, flags::Integer) = utf8proc_map(bytestring(s), flags)
+utf8proc_map(s::AbstractString, flags::Integer) = utf8proc_map(String(s), flags)
function normalize_string(s::AbstractString; stable::Bool=false, compat::Bool=false, compose::Bool=true, decompose::Bool=false, stripignore::Bool=false, rejectna::Bool=false, newline2ls::Bool=false, newline2ps::Bool=false, newline2lf::Bool=false, stripcc::Bool=false, casefold::Bool=false, lump::Bool=false, stripmark::Bool=false)
flags = 0
diff --git a/base/util.jl b/base/util.jl
index 37421ec255b94..b57f2f91591cf 100644
--- a/base/util.jl
+++ b/base/util.jl
@@ -235,12 +235,12 @@ if blas_vendor() == :openblas64
macro blasfunc(x)
return Expr(:quote, Symbol(x, "64_"))
end
- openblas_get_config() = strip(bytestring( ccall((:openblas_get_config64_, Base.libblas_name), Ptr{UInt8}, () )))
+ openblas_get_config() = strip(String( ccall((:openblas_get_config64_, Base.libblas_name), Ptr{UInt8}, () )))
else
macro blasfunc(x)
return Expr(:quote, x)
end
- openblas_get_config() = strip(bytestring( ccall((:openblas_get_config, Base.libblas_name), Ptr{UInt8}, () )))
+ openblas_get_config() = strip(String( ccall((:openblas_get_config, Base.libblas_name), Ptr{UInt8}, () )))
end
function blas_set_num_threads(n::Integer)
@@ -375,8 +375,8 @@ warn(err::Exception; prefix="ERROR: ", kw...) =
function julia_cmd(julia=joinpath(JULIA_HOME, julia_exename()))
opts = JLOptions()
- cpu_target = bytestring(opts.cpu_target)
- image_file = bytestring(opts.image_file)
+ cpu_target = String(opts.cpu_target)
+ image_file = String(opts.image_file)
compile = if opts.compile_enabled == 0
"no"
elseif opts.compile_enabled == 2
diff --git a/base/version.jl b/base/version.jl
index 1fb57679145a2..e9724d6157223 100644
--- a/base/version.jl
+++ b/base/version.jl
@@ -82,7 +82,7 @@ function split_idents(s::AbstractString)
idents = split(s, '.')
ntuple(length(idents)) do i
ident = idents[i]
- ismatch(r"^\d+$", ident) ? parse(Int, ident) : bytestring(ident)
+ ismatch(r"^\d+$", ident) ? parse(Int, ident) : String(ident)
end
end
diff --git a/contrib/BBEditTextWrangler-julia.plist b/contrib/BBEditTextWrangler-julia.plist
index 5115aec30bbf9..fb6a20cb8f1e8 100644
--- a/contrib/BBEditTextWrangler-julia.plist
+++ b/contrib/BBEditTextWrangler-julia.plist
@@ -238,7 +238,6 @@
broadcast_setindex!
bswap
bytes2hex
- bytestring
c_calloc
c_free
c_malloc
diff --git a/contrib/julia-config.jl b/contrib/julia-config.jl
index 53c8538d6a09d..a5b2fc1c54b27 100755
--- a/contrib/julia-config.jl
+++ b/contrib/julia-config.jl
@@ -10,7 +10,7 @@ const options =
function imagePath()
opts = Base.JLOptions();
- bytestring(opts.image_file);
+ String(opts.image_file);
end
function libDir()
diff --git a/doc/manual/calling-c-and-fortran-code.rst b/doc/manual/calling-c-and-fortran-code.rst
index 6d3a7aed48459..42a0ce39b6daa 100644
--- a/doc/manual/calling-c-and-fortran-code.rst
+++ b/doc/manual/calling-c-and-fortran-code.rst
@@ -85,7 +85,7 @@ of an environment variable, one makes a call like this::
julia> path = ccall((:getenv, "libc"), Cstring, (Cstring,), "SHELL")
Cstring(@0x00007fff5fbffc45)
- julia> bytestring(path)
+ julia> String(path)
"/bin/bash"
Note that the argument type tuple must be written as ``(Cstring,)``,
@@ -117,7 +117,7 @@ which is a simplified version of the actual definition from
if val == C_NULL
error("getenv: undefined variable: ", var)
end
- bytestring(val)
+ String(val)
end
The C ``getenv`` function indicates an error by returning ``NULL``, but
@@ -141,7 +141,7 @@ machine's hostname::
(Ptr{UInt8}, Csize_t),
hostname, sizeof(hostname))
hostname[end] = 0; # ensure null-termination
- return bytestring(pointer(hostname))
+ return String(pointer(hostname))
end
This example first allocates an array of bytes, then calls the C library
@@ -885,7 +885,7 @@ it is finished with them.
Whenever you have created a pointer to Julia data, you must ensure the original data
exists until you are done with using the pointer. Many methods in Julia such as
-:func:`unsafe_load` and :func:`bytestring` make copies of data instead of taking ownership
+:func:`unsafe_load` and :func:`String` make copies of data instead of taking ownership
of the buffer, so that it is safe to free (or alter) the original data without
affecting Julia. A notable exception is :func:`pointer_to_array` which, for performance
reasons, shares (or can be told to take ownership of) the underlying buffer.
diff --git a/doc/stdlib/strings.rst b/doc/stdlib/strings.rst
index e846d377cd05d..fc378b859f7ba 100644
--- a/doc/stdlib/strings.rst
+++ b/doc/stdlib/strings.rst
@@ -50,13 +50,13 @@
Create a string from any value using the ``showall`` function.
-.. function:: bytestring(::Ptr{UInt8}, [length])
+.. function:: String(::Ptr{UInt8}, [length])
.. Docstring generated from Julia source
Create a string from the address of a C (0-terminated) string encoded in ASCII or UTF-8. A copy is made; the ptr can be safely freed. If ``length`` is specified, the string does not have to be 0-terminated.
-.. function:: bytestring(s)
+.. function:: String(s::AbstractString)
.. Docstring generated from Julia source
diff --git a/examples/clustermanager/0mq/ZMQCM.jl b/examples/clustermanager/0mq/ZMQCM.jl
index ac81fb7fa1834..0a0bce0699af3 100644
--- a/examples/clustermanager/0mq/ZMQCM.jl
+++ b/examples/clustermanager/0mq/ZMQCM.jl
@@ -134,17 +134,17 @@ end
function recv_data()
try
#println("On $(manager.zid_self) waiting to recv message")
- zid = parse(Int,bytestring(ZMQ.recv(manager.sub)))
+ zid = parse(Int,String(ZMQ.recv(manager.sub)))
assert(zid == manager.zid_self)
- from_zid = parse(Int,bytestring(ZMQ.recv(manager.sub)))
- mtype = bytestring(ZMQ.recv(manager.sub))
+ from_zid = parse(Int,String(ZMQ.recv(manager.sub)))
+ mtype = String(ZMQ.recv(manager.sub))
#println("$zid received message of type $mtype from $from_zid")
data = ZMQ.recv(manager.sub)
if mtype == CONTROL_MSG
- cmsg = bytestring(data)
+ cmsg = String(data)
if cmsg == REQUEST_ACK
#println("$from_zid REQUESTED_ACK from $zid")
# send back a control_msg
diff --git a/src/common_symbols2.inc b/src/common_symbols2.inc
index ffc09e7b69a3a..7c6480d94e56b 100644
--- a/src/common_symbols2.inc
+++ b/src/common_symbols2.inc
@@ -212,7 +212,7 @@ jl_symbol("_var2"),
jl_symbol("noinline"),
jl_symbol("multidimensional.jl"),
jl_symbol("sparse/sparsematrix.jl"),
-jl_symbol("bytestring"),
+jl_symbol("String"),
jl_symbol("ast"),
jl_symbol("lda"),
jl_symbol("#s64"),
diff --git a/src/jlapi.c b/src/jlapi.c
index 4f4fcdf79ce55..a169b8bc302f2 100644
--- a/src/jlapi.c
+++ b/src/jlapi.c
@@ -107,7 +107,7 @@ JL_DLLEXPORT size_t jl_array_size(jl_value_t *a, int d)
return jl_array_dim(a, d);
}
-JL_DLLEXPORT const char *jl_bytestring_ptr(jl_value_t *s)
+JL_DLLEXPORT const char *jl_string_ptr(jl_value_t *s)
{
return jl_string_data(s);
}
diff --git a/src/julia.h b/src/julia.h
index 46f602c4d8e90..058f3c947e57d 100644
--- a/src/julia.h
+++ b/src/julia.h
@@ -1169,7 +1169,7 @@ JL_DLLEXPORT int jl_array_rank(jl_value_t *a);
JL_DLLEXPORT size_t jl_array_size(jl_value_t *a, int d);
// strings
-JL_DLLEXPORT const char *jl_bytestring_ptr(jl_value_t *s);
+JL_DLLEXPORT const char *jl_string_ptr(jl_value_t *s);
// modules and global variables
extern JL_DLLEXPORT jl_module_t *jl_main_module;
diff --git a/test/cmdlineargs.jl b/test/cmdlineargs.jl
index 7bb773a87636a..06224d9d792a0 100644
--- a/test/cmdlineargs.jl
+++ b/test/cmdlineargs.jl
@@ -60,7 +60,7 @@ let exename = `$(Base.julia_cmd()) --precompiled=yes`
# NOTE: this test only holds true when there is a sys.{dll,dylib,so} shared library present.
# The tests are also limited to unix platforms at the moment because loading the system image
# not turned on for Window's binary builds at the moment.
- @unix_only if Libdl.dlopen_e(splitext(bytestring(Base.JLOptions().image_file))[1]) != C_NULL
+ @unix_only if Libdl.dlopen_e(splitext(String(Base.JLOptions().image_file))[1]) != C_NULL
@test !success(`$exename -C invalidtarget`)
@test !success(`$exename --cpu-target=invalidtarget`)
end
@@ -77,7 +77,7 @@ let exename = `$(Base.julia_cmd()) --precompiled=yes`
touch(fname)
fname = realpath(fname)
try
- @test readchomp(`$exename --machinefile $fname -e "println(bytestring(Base.JLOptions().machinefile))"`) == fname
+ @test readchomp(`$exename --machinefile $fname -e "println(String(Base.JLOptions().machinefile))"`) == fname
finally
rm(fname)
end
diff --git a/test/dict.jl b/test/dict.jl
index cba050ec8bde1..d31da6008edb8 100644
--- a/test/dict.jl
+++ b/test/dict.jl
@@ -301,7 +301,7 @@ let d = Dict((1=>2) => (3=>45), (3=>10) => (10=>11))
# Check explicitly for the expected strings, since the CPU bitness effects
# dictionary ordering.
- result = bytestring(buf)
+ result = String(buf)
@test contains(result, "Dict")
@test contains(result, "(1=>2)=>(3=>45)")
@test contains(result, "(3=>10)=>(10=>11)")
@@ -314,8 +314,8 @@ let sbuff = IOBuffer(),
io = Base.IOContext(Base.IOContext(sbuff, :limit_output => true), :displaysize => (10, 20))
Base.showdict(io, Dict(Alpha()=>1))
- @test !contains(bytestring(sbuff), "…")
- @test endswith(bytestring(sbuff), "α => 1")
+ @test !contains(String(sbuff), "…")
+ @test endswith(String(sbuff), "α => 1")
end
# issue #2540
diff --git a/test/file.jl b/test/file.jl
index 432c2c0598c90..91ae209dbad51 100644
--- a/test/file.jl
+++ b/test/file.jl
@@ -876,7 +876,7 @@ end
function test_LibcFILE(FILEp)
buf = Array(UInt8, 8)
str = ccall(:fread, Csize_t, (Ptr{Void}, Csize_t, Csize_t, Ptr{Void}), buf, 1, 8, FILEp)
- @test bytestring(buf) == "Hello, w"
+ @test String(buf) == "Hello, w"
@test position(FILEp) == 8
seek(FILEp, 5)
@test position(FILEp) == 5
diff --git a/test/grisu.jl b/test/grisu.jl
index 554e436005d0e..02bcb5bb7fe38 100644
--- a/test/grisu.jl
+++ b/test/grisu.jl
@@ -3,14 +3,14 @@
using Base.Grisu
function trimrep(buffer)
- len = length(bytestring(pointer(buffer)))
+ len = length(String(pointer(buffer)))
ind = len
for i = len:-1:1
buffer[i] != 0x30 && break
ind -= 1
end
buffer[ind+1] = 0
- return bytestring(pointer(buffer))
+ return String(pointer(buffer))
end
const bufsize = 500
@@ -450,547 +450,547 @@ fill!(buffer,0);
#fastfixedtoa
status,len,point = Grisu.fastfixedtoa(1.0, 0,1, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1.0, 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1.0, 0,0, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0xFFFFFFFF, 0,5, buffer)
-@test "4294967295" == bytestring(pointer(buffer))
+@test "4294967295" == String(pointer(buffer))
@test 10 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(4294967296.0, 0,5, buffer)
-@test "4294967296" == bytestring(pointer(buffer)) #todo
+@test "4294967296" == String(pointer(buffer)) #todo
@test 10 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1e21, 0,5, buffer)
-@test "1" == bytestring(pointer(buffer)) #todo extra '0's
+@test "1" == String(pointer(buffer)) #todo extra '0's
@test 22 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(999999999999999868928.00, 0,2, buffer)
-@test "999999999999999868928" == bytestring(pointer(buffer)) #todo extra '0'
+@test "999999999999999868928" == String(pointer(buffer)) #todo extra '0'
@test 21 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(6.9999999999999989514240000e+21, 0,5, buffer)
-@test "6999999999999998951424" == bytestring(pointer(buffer)) #todo short several '9's
+@test "6999999999999998951424" == String(pointer(buffer)) #todo short several '9's
@test 22 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1.5, 0,5, buffer)
-@test "15" == bytestring(pointer(buffer))
+@test "15" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1.55, 0,5, buffer)
-@test "155" == bytestring(pointer(buffer))
+@test "155" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1.55, 0,1, buffer)
-@test "16" == bytestring(pointer(buffer))
+@test "16" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1.00000001, 0,15, buffer)
-@test "100000001" == bytestring(pointer(buffer))
+@test "100000001" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.1, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 0 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.01, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.001, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -2 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0001, 0,10, buffer) #todo
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -3 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00001, 0,10, buffer) #todo
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -4 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000001, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -5 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000001, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -6 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000001, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -7 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000001, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -8 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000001, 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -9 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000000001, 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -10 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000001, 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -11 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000000001, 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -12 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000000000001, 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -13 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000001, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -14 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000000000001, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -15 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000000000000001, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -16 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000000001, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -17 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000000000000001, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -18 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000000000000000001, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -19 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.10000000004, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 0 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.01000000004, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00100000004, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -2 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00010000004, 0,10, buffer) #todo
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -3 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00001000004, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -4 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000100004, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -5 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000010004, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -6 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000001004, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -7 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000000104, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -8 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000001000004, 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -9 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000000100004, 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -10 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000000010004, 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -11 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000000001004, 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -12 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000000000104, 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -13 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000001000004, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -14 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000000100004, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -15 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000000010004, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -16 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000000001004, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -17 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000000000104, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -18 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000000000014, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -19 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.10000000006, 0,10, buffer)
-@test "1000000001" == bytestring(pointer(buffer))
+@test "1000000001" == String(pointer(buffer))
@test 0 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.01000000006, 0,10, buffer)
-@test "100000001" == bytestring(pointer(buffer))
+@test "100000001" == String(pointer(buffer))
@test -1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00100000006, 0,10, buffer)
-@test "10000001" == bytestring(pointer(buffer))
+@test "10000001" == String(pointer(buffer))
@test -2 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00010000006, 0,10, buffer)
-@test "1000001" == bytestring(pointer(buffer))
+@test "1000001" == String(pointer(buffer))
@test -3 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00001000006, 0,10, buffer)
-@test "100001" == bytestring(pointer(buffer))
+@test "100001" == String(pointer(buffer))
@test -4 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000100006, 0,10, buffer)
-@test "10001" == bytestring(pointer(buffer))
+@test "10001" == String(pointer(buffer))
@test -5 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000010006, 0,10, buffer)
-@test "1001" == bytestring(pointer(buffer))
+@test "1001" == String(pointer(buffer))
@test -6 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000001006, 0,10, buffer)
-@test "101" == bytestring(pointer(buffer))
+@test "101" == String(pointer(buffer))
@test -7 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000000106, 0,10, buffer)
-@test "11" == bytestring(pointer(buffer))
+@test "11" == String(pointer(buffer))
@test -8 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000001000006, 0,15, buffer)
-@test "100001" == bytestring(pointer(buffer))
+@test "100001" == String(pointer(buffer))
@test -9 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000000100006, 0,15, buffer)
-@test "10001" == bytestring(pointer(buffer))
+@test "10001" == String(pointer(buffer))
@test -10 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000000010006, 0,15, buffer)
-@test "1001" == bytestring(pointer(buffer))
+@test "1001" == String(pointer(buffer))
@test -11 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000000001006, 0,15, buffer)
-@test "101" == bytestring(pointer(buffer))
+@test "101" == String(pointer(buffer))
@test -12 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000000000000106, 0,15, buffer)
-@test "11" == bytestring(pointer(buffer))
+@test "11" == String(pointer(buffer))
@test -13 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000001000006, 0,20, buffer)
-@test "100001" == bytestring(pointer(buffer))
+@test "100001" == String(pointer(buffer))
@test -14 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000000100006, 0,20, buffer)
-@test "10001" == bytestring(pointer(buffer))
+@test "10001" == String(pointer(buffer))
@test -15 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000000010006, 0,20, buffer)
-@test "1001" == bytestring(pointer(buffer))
+@test "1001" == String(pointer(buffer))
@test -16 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000000001006, 0,20, buffer)
-@test "101" == bytestring(pointer(buffer))
+@test "101" == String(pointer(buffer))
@test -17 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000000000106, 0,20, buffer)
-@test "11" == bytestring(pointer(buffer))
+@test "11" == String(pointer(buffer))
@test -18 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000000000000000016, 0,20, buffer)
-@test "2" == bytestring(pointer(buffer))
+@test "2" == String(pointer(buffer))
@test -19 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.6, 0,0, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.96, 0,1, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.996, 0,2, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.9996, 0,3, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.99996, 0,4, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.999996, 0,5, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.9999996, 0,6, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.99999996, 0,7, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.999999996, 0,8, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.9999999996, 0,9, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.99999999996, 0,10, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.999999999996, 0,11, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.9999999999996, 0,12, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.99999999999996, 0,13, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.999999999999996, 0,14, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.9999999999999996, 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00999999999999996, 0,16, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000999999999999996, 0,17, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -2 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.0000999999999999996, 0,18, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -3 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.00000999999999999996, 0,19, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -4 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.000000999999999999996, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -5 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(323423.234234, 0,10, buffer)
-@test "323423234234" == bytestring(pointer(buffer))
+@test "323423234234" == String(pointer(buffer))
@test 6 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(12345678.901234, 0,4, buffer)
-@test "123456789012" == bytestring(pointer(buffer))
+@test "123456789012" == String(pointer(buffer))
@test 8 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(98765.432109, 0,5, buffer)
-@test "9876543211" == bytestring(pointer(buffer))
+@test "9876543211" == String(pointer(buffer))
@test 5 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(42, 0,20, buffer)
-@test "42" == bytestring(pointer(buffer))
+@test "42" == String(pointer(buffer))
@test 2 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(0.5, 0,0, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1e-23, 0,10, buffer)
-@test "" == bytestring(pointer(buffer))
+@test "" == String(pointer(buffer))
@test -10 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1e-123, 0,2, buffer)
-@test "" == bytestring(pointer(buffer))
+@test "" == String(pointer(buffer))
@test -2 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1e-123, 0,0, buffer)
-@test "" == bytestring(pointer(buffer))
+@test "" == String(pointer(buffer))
@test 0 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1e-23, 0,20, buffer)
-@test "" == bytestring(pointer(buffer))
+@test "" == String(pointer(buffer))
@test -20 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1e-21, 0,20, buffer)
-@test "" == bytestring(pointer(buffer))
+@test "" == String(pointer(buffer))
@test -20 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1e-22, 0,20, buffer)
-@test "" == bytestring(pointer(buffer))
+@test "" == String(pointer(buffer))
@test -20 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(6e-21, 0,20, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -19 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(9.1193616301674545152000000e+19, 0,0,buffer)
-@test "91193616301674545152" == bytestring(pointer(buffer))
+@test "91193616301674545152" == String(pointer(buffer))
@test 20 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(4.8184662102767651659096515e-04, 0,19,buffer)
-@test "4818466210276765" == bytestring(pointer(buffer))
+@test "4818466210276765" == String(pointer(buffer))
@test -3 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1.9023164229540652612705182e-23, 0,8,buffer)
-@test "" == bytestring(pointer(buffer))
+@test "" == String(pointer(buffer))
@test -8 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(1000000000000000128.0, 0,0,buffer)
-@test "1000000000000000128" == bytestring(pointer(buffer))
+@test "1000000000000000128" == String(pointer(buffer))
@test 19 == point
fill!(buffer,0);
@@ -1068,13 +1068,13 @@ fill!(buffer,0);
map(x->Grisu.Bignums.zero!(x),bignums)
status,len,point = Grisu.bignumdtoa(4294967272.0, Grisu.SHORTEST, 0, buffer,bignums)
-@test "4294967272" == bytestring(pointer(buffer))
+@test "4294967272" == String(pointer(buffer))
@test 10 == point
fill!(buffer,0);
map(x->Grisu.Bignums.zero!(x),bignums)
status,len,point = Grisu.bignumdtoa(4294967272.0, Grisu.FIXED, 5, buffer,bignums)
-@test "429496727200000" == bytestring(pointer(buffer))
+@test "429496727200000" == String(pointer(buffer))
@test 10 == point
fill!(buffer,0);
map(x->Grisu.Bignums.zero!(x),bignums)
@@ -1308,155 +1308,155 @@ if status
end
status,len,point = Grisu.fastfixedtoa(Float16(1.0), 0,1, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(1.0), 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(1.0), 0,0, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(1.5), 0,5, buffer)
-@test "15" == bytestring(pointer(buffer))
+@test "15" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(1.55), 0,5, buffer)
-@test "15498" == bytestring(pointer(buffer)) #todo
+@test "15498" == String(pointer(buffer)) #todo
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(1.55), 0,1, buffer)
-@test "15" == bytestring(pointer(buffer))
+@test "15" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(1.00000001), 0,15, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.1), 0,10, buffer)
-@test "999755859" == bytestring(pointer(buffer))
+@test "999755859" == String(pointer(buffer))
@test -1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.01), 0,10, buffer)
-@test "100021362" == bytestring(pointer(buffer))
+@test "100021362" == String(pointer(buffer))
@test -1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.001), 0,10, buffer)
-@test "10004044" == bytestring(pointer(buffer))
+@test "10004044" == String(pointer(buffer))
@test -2 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.0001), 0,10, buffer) #todo
-@test "1000166" == bytestring(pointer(buffer))
+@test "1000166" == String(pointer(buffer))
@test -3 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.00001), 0,10, buffer) #todo
-@test "100136" == bytestring(pointer(buffer))
+@test "100136" == String(pointer(buffer))
@test -4 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.000001), 0,10, buffer)
-@test "10133" == bytestring(pointer(buffer))
+@test "10133" == String(pointer(buffer))
@test -5 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.0000001), 0,10, buffer)
-@test "1192" == bytestring(pointer(buffer))
+@test "1192" == String(pointer(buffer))
@test -6 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.6), 0,0, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.96), 0,1, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.996), 0,2, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.9996), 0,3, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.99996), 0,4, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.999996), 0,5, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.9999996), 0,6, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.99999996), 0,7, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(42), 0,20, buffer)
-@test "42" == bytestring(pointer(buffer))
+@test "42" == String(pointer(buffer))
@test 2 == point
fill!(buffer,0);
status,len,point = Grisu.fastfixedtoa(Float16(0.5), 0,0, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
#dtoa
len,point,neg = Grisu.grisu(0.0, Grisu.SHORTEST, 0, buffer)
-@test "0" == bytestring(pointer(buffer))
+@test "0" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
len,point,neg = Grisu.grisu(Float32(0.0), Grisu.SHORTEST, 0, buffer)
-@test "0" == bytestring(pointer(buffer))
+@test "0" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
len,point,neg = Grisu.grisu(0.0, Grisu.FIXED, 2, buffer)
@test 1 >= len-1
-@test "0" == bytestring(pointer(buffer))
+@test "0" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
len,point,neg = Grisu.grisu(0.0, Grisu.PRECISION, 3, buffer)
@test 1 >= len-1
-@test "0" == bytestring(pointer(buffer))
+@test "0" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
len,point,neg = Grisu.grisu(1.0, Grisu.SHORTEST, 0, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
len,point,neg = Grisu.grisu(Float32(1.0), Grisu.SHORTEST, 0, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
@@ -1473,12 +1473,12 @@ len,point,neg = Grisu.grisu(1.0, Grisu.PRECISION, 3, buffer)
fill!(buffer,0);
len,point,neg = Grisu.grisu(1.5, Grisu.SHORTEST, 0, buffer)
-@test "15" == bytestring(pointer(buffer))
+@test "15" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
len,point,neg = Grisu.grisu(Float32(1.5), Grisu.SHORTEST, 0, buffer)
-@test "15" == bytestring(pointer(buffer))
+@test "15" == String(pointer(buffer))
@test 1 == point
fill!(buffer,0);
@@ -1496,13 +1496,13 @@ fill!(buffer,0);
min_double = 5e-324
len,point,neg = Grisu.grisu(min_double, Grisu.SHORTEST, 0, buffer)
-@test "5" == bytestring(pointer(buffer))
+@test "5" == String(pointer(buffer))
@test -323 == point
fill!(buffer,0);
min_float = 1e-45
len,point,neg = Grisu.grisu(Float32(min_float), Grisu.SHORTEST, 0, buffer)
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test -44 == point
fill!(buffer,0);
@@ -1520,13 +1520,13 @@ fill!(buffer,0);
max_double = 1.7976931348623157e308
len,point,neg = Grisu.grisu(max_double, Grisu.SHORTEST, 0, buffer)
-@test "17976931348623157" == bytestring(pointer(buffer))
+@test "17976931348623157" == String(pointer(buffer))
@test 309 == point
fill!(buffer,0);
max_float = 3.4028234e38
len,point,neg = Grisu.grisu(Float32(max_float), Grisu.SHORTEST, 0, buffer)
-@test "34028235" == bytestring(pointer(buffer))
+@test "34028235" == String(pointer(buffer))
@test 39 == point
fill!(buffer,0);
@@ -1537,12 +1537,12 @@ len,point,neg = Grisu.grisu(max_double, Grisu.PRECISION, 7, buffer)
fill!(buffer,0);
len,point,neg = Grisu.grisu(4294967272.0, Grisu.SHORTEST, 0, buffer)
-@test "4294967272" == bytestring(pointer(buffer))
+@test "4294967272" == String(pointer(buffer))
@test 10 == point
fill!(buffer,0);
len,point,neg = Grisu.grisu(Float32(4294967272.0), Grisu.SHORTEST, 0, buffer)
-@test "42949673" == bytestring(pointer(buffer))
+@test "42949673" == String(pointer(buffer))
@test 10 == point
fill!(buffer,0);
@@ -1559,7 +1559,7 @@ len,point,neg = Grisu.grisu(4294967272.0, Grisu.PRECISION, 14, buffer)
fill!(buffer,0);
len,point,neg = Grisu.grisu(4.1855804968213567e298, Grisu.SHORTEST, 0, buffer)
-@test "4185580496821357" == bytestring(pointer(buffer))
+@test "4185580496821357" == String(pointer(buffer))
@test 299 == point
fill!(buffer,0);
@@ -1570,7 +1570,7 @@ len,point,neg = Grisu.grisu(4.1855804968213567e298, Grisu.PRECISION, 20, buffer)
fill!(buffer,0);
len,point,neg = Grisu.grisu(5.5626846462680035e-309, Grisu.SHORTEST, 0, buffer)
-@test "5562684646268003" == bytestring(pointer(buffer))
+@test "5562684646268003" == String(pointer(buffer))
@test -308 == point
fill!(buffer,0);
@@ -1582,13 +1582,13 @@ fill!(buffer,0);
len,point,neg = Grisu.grisu(-2147483648.0, Grisu.SHORTEST, 0, buffer)
@test 1 == neg
-@test "2147483648" == bytestring(pointer(buffer))
+@test "2147483648" == String(pointer(buffer))
@test 10 == point
fill!(buffer,0);
len,point,neg = Grisu.grisu(Float32(-2147483648.), Grisu.SHORTEST, 0, buffer)
@test 1 == neg
-@test "21474836" == bytestring(pointer(buffer))
+@test "21474836" == String(pointer(buffer))
@test 10 == point
fill!(buffer,0);
@@ -1607,7 +1607,7 @@ fill!(buffer,0);
len,point,neg = Grisu.grisu(-3.5844466002796428e+298, Grisu.SHORTEST, 0, buffer)
@test 1 == neg
-@test "35844466002796428" == bytestring(pointer(buffer))
+@test "35844466002796428" == String(pointer(buffer))
@test 299 == point
fill!(buffer,0);
@@ -1620,13 +1620,13 @@ fill!(buffer,0);
v = reinterpret(Float64,0x0010000000000000)
len,point,neg = Grisu.grisu(v, Grisu.SHORTEST, 0, buffer)
-@test "22250738585072014" == bytestring(pointer(buffer))
+@test "22250738585072014" == String(pointer(buffer))
@test -307 == point
fill!(buffer,0);
f = reinterpret(Float32,0x00800000)
len,point,neg = Grisu.grisu(f, Grisu.SHORTEST, 0, buffer)
-@test "11754944" == bytestring(pointer(buffer))
+@test "11754944" == String(pointer(buffer))
@test -37 == point
fill!(buffer,0);
@@ -1638,13 +1638,13 @@ fill!(buffer,0);
v = reinterpret(Float64,0x000FFFFFFFFFFFFF)
len,point,neg = Grisu.grisu(v, Grisu.SHORTEST, 0, buffer)
-@test "2225073858507201" == bytestring(pointer(buffer))
+@test "2225073858507201" == String(pointer(buffer))
@test -307 == point
fill!(buffer,0);
f = reinterpret(Float32,0x007FFFFF)
len,point,neg = Grisu.grisu(f, Grisu.SHORTEST, 0, buffer)
-@test "11754942" == bytestring(pointer(buffer))
+@test "11754942" == String(pointer(buffer))
@test -37 == point
fill!(buffer,0);
@@ -1656,18 +1656,18 @@ fill!(buffer,0);
len,point,neg = Grisu.grisu(4128420500802942e-24, Grisu.SHORTEST, 0, buffer)
@test 0 == neg
-@test "4128420500802942" == bytestring(pointer(buffer))
+@test "4128420500802942" == String(pointer(buffer))
@test -8 == point
fill!(buffer,0);
v = -3.9292015898194142585311918e-10
len,point,neg = Grisu.grisu(v, Grisu.SHORTEST, 0, buffer)
-@test "39292015898194143" == bytestring(pointer(buffer))
+@test "39292015898194143" == String(pointer(buffer))
fill!(buffer,0);
f = Float32(-3.9292015898194142585311918e-10)
len,point,neg = Grisu.grisu(f, Grisu.SHORTEST, 0, buffer)
-@test "39292017" == bytestring(pointer(buffer))
+@test "39292017" == String(pointer(buffer))
fill!(buffer,0);
v = 4194304.0
@@ -1734,20 +1734,20 @@ len,point,neg = Grisu.grisu(-1.0, Grisu.FIXED, 1, buffer)
len,point,neg = Grisu.grisu(0.0, Grisu.PRECISION, 0, buffer)
@test 0 >= len-1
-@test "" == bytestring(pointer(buffer))
+@test "" == String(pointer(buffer))
@test !neg
len,point,neg = Grisu.grisu(1.0, Grisu.PRECISION, 0, buffer)
@test 0 >= len-1
-@test "" == bytestring(pointer(buffer))
+@test "" == String(pointer(buffer))
@test !neg
len,point,neg = Grisu.grisu(0.0, Grisu.FIXED, 0, buffer)
@test 1 >= len-1
-@test "0" == bytestring(pointer(buffer))
+@test "0" == String(pointer(buffer))
@test !neg
len,point,neg = Grisu.grisu(1.0, Grisu.FIXED, 0, buffer)
@test 1 >= len-1
-@test "1" == bytestring(pointer(buffer))
+@test "1" == String(pointer(buffer))
@test !neg
diff --git a/test/iobuffer.jl b/test/iobuffer.jl
index f089e4ee3b484..6c5a06965d346 100644
--- a/test/iobuffer.jl
+++ b/test/iobuffer.jl
@@ -17,7 +17,7 @@ seek(io, 0)
a = Array(UInt8, 2)
@test read!(io, a) == a
@test a == UInt8['b','c']
-@test bytestring(io) == "abc"
+@test String(io) == "abc"
seek(io, 1)
truncate(io, 2)
@test position(io) == 1
@@ -159,12 +159,12 @@ let io=IOBuffer(SubString("***αhelloworldω***",4,16)), io2 = IOBuffer(b"goodni
@test_throws ArgumentError write(io,'β')
a = Array{UInt8}(10)
@test read!(io, a) === a
- @test bytestring(a) == "helloworld"
+ @test String(a) == "helloworld"
@test read(io, Char) == 'ω'
@test_throws EOFError read(io,UInt8)
skip(io, -3)
@test readstring(io) == "dω"
- @test bytestring(io) == "αhelloworldω"
+ @test String(io) == "αhelloworldω"
@test_throws ArgumentError write(io,"!")
@test takebuf_array(io) == b"αhelloworldω"
seek(io, 2)
@@ -179,7 +179,7 @@ let io=IOBuffer(SubString("***αhelloworldω***",4,16)), io2 = IOBuffer(b"goodni
seek(io2, 0)
write(io2, io2)
@test readstring(io2) == ""
- @test bytestring(io2) == "goodnightmoonhelloworld"
+ @test String(io2) == "goodnightmoonhelloworld"
end
# issue #11917
diff --git a/test/lineedit.jl b/test/lineedit.jl
index 212c849c610bf..3f24fdf9e8792 100644
--- a/test/lineedit.jl
+++ b/test/lineedit.jl
@@ -276,25 +276,25 @@ seekend(buf)
@test LineEdit.edit_delete_prev_word(buf)
@test position(buf) == 5
@test buf.size == 5
-@test bytestring(buf.data[1:buf.size]) == "type "
+@test String(buf.data[1:buf.size]) == "type "
buf = IOBuffer("4 +aaa+ x")
seek(buf,8)
@test LineEdit.edit_delete_prev_word(buf)
@test position(buf) == 3
@test buf.size == 4
-@test bytestring(buf.data[1:buf.size]) == "4 +x"
+@test String(buf.data[1:buf.size]) == "4 +x"
buf = IOBuffer("x = func(arg1,arg2 , arg3)")
seekend(buf)
LineEdit.char_move_word_left(buf)
@test position(buf) == 21
@test LineEdit.edit_delete_prev_word(buf)
-@test bytestring(buf.data[1:buf.size]) == "x = func(arg1,arg3)"
+@test String(buf.data[1:buf.size]) == "x = func(arg1,arg3)"
@test LineEdit.edit_delete_prev_word(buf)
-@test bytestring(buf.data[1:buf.size]) == "x = func(arg3)"
+@test String(buf.data[1:buf.size]) == "x = func(arg3)"
@test LineEdit.edit_delete_prev_word(buf)
-@test bytestring(buf.data[1:buf.size]) == "x = arg3)"
+@test String(buf.data[1:buf.size]) == "x = arg3)"
# Unicode combining characters
let buf = IOBuffer()
@@ -304,7 +304,7 @@ let buf = IOBuffer()
LineEdit.edit_move_right(buf)
@test nb_available(buf) == 0
LineEdit.edit_backspace(buf)
- @test bytestring(buf.data[1:buf.size]) == "a"
+ @test String(buf.data[1:buf.size]) == "a"
end
## edit_transpose ##
@@ -312,34 +312,34 @@ let buf = IOBuffer()
LineEdit.edit_insert(buf, "abcde")
seek(buf,0)
LineEdit.edit_transpose(buf)
- @test bytestring(buf.data[1:buf.size]) == "abcde"
+ @test String(buf.data[1:buf.size]) == "abcde"
LineEdit.char_move_right(buf)
LineEdit.edit_transpose(buf)
- @test bytestring(buf.data[1:buf.size]) == "bacde"
+ @test String(buf.data[1:buf.size]) == "bacde"
LineEdit.edit_transpose(buf)
- @test bytestring(buf.data[1:buf.size]) == "bcade"
+ @test String(buf.data[1:buf.size]) == "bcade"
seekend(buf)
LineEdit.edit_transpose(buf)
- @test bytestring(buf.data[1:buf.size]) == "bcaed"
+ @test String(buf.data[1:buf.size]) == "bcaed"
LineEdit.edit_transpose(buf)
- @test bytestring(buf.data[1:buf.size]) == "bcade"
+ @test String(buf.data[1:buf.size]) == "bcade"
seek(buf, 0)
LineEdit.edit_clear(buf)
LineEdit.edit_insert(buf, "αβγδε")
seek(buf,0)
LineEdit.edit_transpose(buf)
- @test bytestring(buf.data[1:buf.size]) == "αβγδε"
+ @test String(buf.data[1:buf.size]) == "αβγδε"
LineEdit.char_move_right(buf)
LineEdit.edit_transpose(buf)
- @test bytestring(buf.data[1:buf.size]) == "βαγδε"
+ @test String(buf.data[1:buf.size]) == "βαγδε"
LineEdit.edit_transpose(buf)
- @test bytestring(buf.data[1:buf.size]) == "βγαδε"
+ @test String(buf.data[1:buf.size]) == "βγαδε"
seekend(buf)
LineEdit.edit_transpose(buf)
- @test bytestring(buf.data[1:buf.size]) == "βγαεδ"
+ @test String(buf.data[1:buf.size]) == "βγαεδ"
LineEdit.edit_transpose(buf)
- @test bytestring(buf.data[1:buf.size]) == "βγαδε"
+ @test String(buf.data[1:buf.size]) == "βγαδε"
end
let
@@ -348,7 +348,7 @@ let
buf = LineEdit.buffer(s)
LineEdit.edit_insert(s,"first line\nsecond line\nthird line")
- @test bytestring(buf.data[1:buf.size]) == "first line\nsecond line\nthird line"
+ @test String(buf.data[1:buf.size]) == "first line\nsecond line\nthird line"
## edit_move_line_start/end ##
seek(buf, 0)
@@ -377,11 +377,11 @@ let
s.key_repeats = 1 # Manually flag a repeated keypress
LineEdit.edit_kill_line(s)
s.key_repeats = 0
- @test bytestring(buf.data[1:buf.size]) == "second line\nthird line"
+ @test String(buf.data[1:buf.size]) == "second line\nthird line"
LineEdit.move_line_end(s)
LineEdit.edit_move_right(s)
LineEdit.edit_yank(s)
- @test bytestring(buf.data[1:buf.size]) == "second line\nfirst line\nthird line"
+ @test String(buf.data[1:buf.size]) == "second line\nfirst line\nthird line"
end
# Issue 7845
diff --git a/test/perf/perfutil.jl b/test/perf/perfutil.jl
index 1974c337c96b2..57b701d1671d5 100644
--- a/test/perf/perfutil.jl
+++ b/test/perf/perfutil.jl
@@ -44,7 +44,7 @@ function submit_to_codespeed(vals,name,desc,unit,test_group,lessisbetter=true)
ret = post( "http://$codespeed_host/result/add/json/", Dict("json" => json([csdata])) )
println( json([csdata]) )
if ret.http_code != 200 && ret.http_code != 202
- error("Error submitting $name [HTTP code $(ret.http_code)], dumping headers and text: $(ret.headers)\n$(bytestring(ret.body))\n\n")
+ error("Error submitting $name [HTTP code $(ret.http_code)], dumping headers and text: $(ret.headers)\n$(String(ret.body))\n\n")
return false
end
return true
diff --git a/test/replutil.jl b/test/replutil.jl
index fa6d51e60145d..732eeb74f0543 100644
--- a/test/replutil.jl
+++ b/test/replutil.jl
@@ -357,7 +357,7 @@ let d = Dict(1 => 2, 3 => 45)
buf = IOBuffer()
td = TextDisplay(buf)
display(td, d)
- result = bytestring(td.io)
+ result = String(td.io)
@test contains(result, summary(d))
diff --git a/test/serialize.jl b/test/serialize.jl
index b702c127585d4..0e2f4b062079d 100644
--- a/test/serialize.jl
+++ b/test/serialize.jl
@@ -94,7 +94,7 @@ end
# Module
create_serialization_stream() do s # user-defined module
mod = b"SomeModule"
- modstring = bytestring(mod)
+ modstring = String(mod)
eval(parse("module $(modstring); end"))
modtype = eval(parse("$(modstring)"))
serialize(s, modtype)
diff --git a/test/socket.jl b/test/socket.jl
index 4ccf773eacf7b..c3123eb7120e3 100644
--- a/test/socket.jl
+++ b/test/socket.jl
@@ -145,10 +145,10 @@ begin
c = Condition()
tsk = @async begin
- @test bytestring(recv(a)) == "Hello World"
+ @test String(recv(a)) == "Hello World"
# Issue 6505
@async begin
- @test bytestring(recv(a)) == "Hello World"
+ @test String(recv(a)) == "Hello World"
notify(c)
end
send(b,ip"127.0.0.1",port,"Hello World")
@@ -160,7 +160,7 @@ begin
tsk = @async begin
@test begin
(addr,data) = recvfrom(a)
- addr == ip"127.0.0.1" && bytestring(data) == "Hello World"
+ addr == ip"127.0.0.1" && String(data) == "Hello World"
end
end
send(b, ip"127.0.0.1",port,"Hello World")
@@ -180,7 +180,7 @@ if @unix? true : (Base.windows_version() >= Base.WINDOWS_VISTA_VER)
tsk = @async begin
@test begin
(addr, data) = recvfrom(a)
- addr == ip"::1" && bytestring(data) == "Hello World"
+ addr == ip"::1" && String(data) == "Hello World"
end
end
send(b, ip"::1", port, "Hello World")
@@ -254,7 +254,7 @@ let
try
@sync begin
send(c, bcastdst, 2000, "hello")
- recvs = [@async @test bytestring(recv(s)) == "hello" for s in (a, b)]
+ recvs = [@async @test String(recv(s)) == "hello" for s in (a, b)]
map(wait, recvs)
end
catch e
diff --git a/test/strings/basic.jl b/test/strings/basic.jl
index a1d295c03393a..a45e0d7a5e08f 100644
--- a/test/strings/basic.jl
+++ b/test/strings/basic.jl
@@ -169,7 +169,6 @@ tstr = tstStringType("12");
gstr = GenericString("12");
@test typeof(string(gstr))==GenericString
-@test bytestring()==""
@test convert(Array{UInt8}, gstr) ==[49;50]
@test convert(Array{Char,1}, gstr) ==['1';'2']
@@ -241,8 +240,8 @@ for T in [BigInt, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Int1
@test isnull(tryparse(T, "1\0"))
end
let s = normalize_string("tést",:NFKC)
- @test bytestring(Base.unsafe_convert(Cstring, s)) == s
- @test bytestring(convert(Cstring, Symbol(s))) == s
+ @test String(Base.unsafe_convert(Cstring, s)) == s
+ @test String(convert(Cstring, Symbol(s))) == s
@test wstring(Base.unsafe_convert(Cwstring, wstring(s))) == s
end
let s = "ba\0d"
@@ -252,7 +251,7 @@ end
cstrdup(s) = @windows? ccall(:_strdup, Cstring, (Cstring,), s) : ccall(:strdup, Cstring, (Cstring,), s)
let p = cstrdup("hello")
- @test bytestring(p) == "hello" == pointer_to_string(cstrdup(p), true)
+ @test String(p) == "hello" == pointer_to_string(cstrdup(p), true)
Libc.free(p)
end
let p = @windows? ccall(:_wcsdup, Cwstring, (Cwstring,), "tést") : ccall(:wcsdup, Cwstring, (Cwstring,), "tést")
@@ -487,9 +486,9 @@ foobaz(ch) = reinterpret(Char, typemax(UInt32))
@test ["a","b"].*["c","d"]' == ["ac" "ad"; "bc" "bd"]
# Make sure NULL pointer are handled consistently by
-# `bytestring`, `ascii` and `utf8`
-@test_throws ArgumentError bytestring(Ptr{UInt8}(0))
-@test_throws ArgumentError bytestring(Ptr{UInt8}(0), 10)
+# `String`, `ascii` and `utf8`
+@test_throws ArgumentError String(Ptr{UInt8}(0))
+@test_throws ArgumentError String(Ptr{UInt8}(0), 10)
@test_throws ArgumentError utf8(Ptr{UInt8}(0))
@test_throws ArgumentError utf8(Ptr{UInt8}(0), 10)
diff --git a/test/strings/types.jl b/test/strings/types.jl
index 5371924f86663..0a510b8355b4c 100644
--- a/test/strings/types.jl
+++ b/test/strings/types.jl
@@ -218,7 +218,7 @@ end
# issue #13974: comparison against pointers
-str = bytestring("foobar")
+str = String("foobar")
ptr = pointer(str)
cstring = Cstring(ptr)
@test ptr == cstring