diff --git a/base/regex.jl b/base/regex.jl index 709099640bfd9..66ec0faa816ba 100644 --- a/base/regex.jl +++ b/base/regex.jl @@ -109,8 +109,8 @@ each_match_overlap(r::Regex, s::String) = RegexMatchIterator(r,s,true) function split(s::String, regex::Regex, include_empty::Bool, limit::Integer) s = cstring(s) + strs = String[] i = j = start(s) - strs = typeof(s)[] while !done(s,i) && (limit == 0 || length(strs) < limit) m = match(regex,s,j) if m == nothing diff --git a/base/string.jl b/base/string.jl index 5fc0079bec4b8..ea871da4a8842 100644 --- a/base/string.jl +++ b/base/string.jl @@ -773,8 +773,8 @@ rpad(s, n::Integer) = rpad(string(s), n, " ") function split(s::String, delims, include_empty::Bool) i = 1 - strs = String[] len = length(s) + strs = String[] while true tokstart = tokend = i while !done(s,i) @@ -797,7 +797,6 @@ end split(s::String) = split(s, (' ','\t','\n','\v','\f','\r'), false) split(s::String, x) = split(s, x, true) -split(s::String, x::Char, incl::Bool) = split(s, (x,), incl) function print_joined(strings, delim, last) i = start(strings)