We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c94bd8 commit 6e17cb2Copy full SHA for 6e17cb2
NEWS.md
@@ -632,8 +632,9 @@ Deprecated or removed
632
633
* `?` can no longer be used as an identifier name ([#22712])
634
635
- * The method `replace(s::AbstractString, pat, r, count)` with `count <= 0` is deprecated
636
- in favor of `replace(s::AbstractString, pat, r, typemax(Int))` ([#22325]).
+ * The method `replace(s::AbstractString, pat, r, [count])` is deprecated
+ in favor of `replace(s::AbstractString, pat => r; [count])` ([#25165]).
637
+ Moreover, `count` cannot be negative anymore (use `typemax(Int)` instead ([#22325]).
638
639
* `read(io, type, dims)` is deprecated to `read!(io, Array{type}(dims))` ([#21450]).
640
base/deprecated.jl
@@ -1346,14 +1346,19 @@ end
1346
function replace(s::AbstractString, pat, f, n::Integer)
1347
if n <= 0
1348
depwarn(string("`replace(s, pat, r, count)` with `count <= 0` is deprecated, use ",
1349
- "`replace(s, pat, r, typemax(Int))` or `replace(s, pat, r)` instead"),
+ "`replace(s, pat=>r, count=typemax(Int))` or `replace(s, pat=>r)` instead"),
1350
:replace)
1351
- replace(s, pat, f)
+ replace(s, pat=>f)
1352
else
1353
- replace_new(String(s), pat, f, n)
+ depwarn(string("`replace(s, pat, r, count)` is deprecated, use ",
1354
+ "`replace(s, pat=>r, count=count)`"),
1355
+ :replace)
1356
+ replace(String(s), pat=>f, count=n)
1357
end
1358
1359
1360
+@deprecate replace(s::AbstractString, pat, f) replace(s, pat=>f)
1361
+
1362
# PR #22475
1363
@deprecate ntuple(f, ::Type{Val{N}}) where {N} ntuple(f, Val(N))
1364
@deprecate fill_to_length(t, val, ::Type{Val{N}}) where {N} fill_to_length(t, val, Val(N)) false
base/libgit2/utils.jl
@@ -83,7 +83,7 @@ Standardise the path string `path` to use POSIX separators.
83
"""
84
function posixpath end
85
if Sys.iswindows()
86
- posixpath(path) = replace(path,'\\','/')
+ posixpath(path) = replace(path,'\\' => '/')
87
elseif Sys.isunix()
88
posixpath(path) = path
89
base/markdown/GitHub/table.jl
@@ -11,7 +11,7 @@ function parserow(stream::IO)
11
row = split(line, r"(?<!\\)\|")
12
length(row) == 1 && return
13
isempty(row[1]) && popfirst!(row)
14
- map!(x -> strip(replace(x, "\\|", "|")), row, row)
+ map!(x -> strip(replace(x, "\\|" => "|")), row, row)
15
isempty(row[end]) && pop!(row)
16
return row
17
@@ -104,7 +104,7 @@ _dash(width, align) =
104
105
function plain(io::IO, md::Table)
106
cells = mapmap(md.rows) do each
107
- replace(plaininline(each), "|", "\\|")
+ replace(plaininline(each), "|" => "\\|")
108
109
padcells!(cells, md.align, len = length, min = 3)
110
for i = axes(cells,1)
base/markdown/render/html.jl
@@ -31,7 +31,7 @@ for ch in "'`!\$%()=+{}[]"
31
32
33
function htmlesc(io::IO, s::AbstractString)
34
- # s1 = replace(s, r"&(?!(\w+|\#\d+);)", "&")
+ # s1 = replace(s, r"&(?!(\w+|\#\d+);)" => "&")
35
for ch in s
36
print(io, get(_htmlescape_chars, ch, ch))
37
base/markdown/render/rst.jl
@@ -124,7 +124,7 @@ end
124
125
rstinline(io::IO, f::Footnote) = print(io, "[", f.id, "]_")
126
127
-rstescape(s) = replace(s, "\\", "\\\\")
+rstescape(s) = replace(s, "\\" => "\\\\")
128
129
rstinline(io::IO, s::AbstractString) = print(io, rstescape(s))
130
base/markdown/render/terminal/formatting.jl
@@ -51,7 +51,7 @@ end
51
# Wrapping
52
53
function ansi_length(s)
54
- replace(s, r"\e\[[0-9]+m", "") |> length
+ replace(s, r"\e\[[0-9]+m" => "") |> length
55
56
57
words(s) = split(s, " ")
base/markdown/render/terminal/render.jl
@@ -114,7 +114,7 @@ function terminline(io::IO, content::Vector)
114
115
116
function terminline(io::IO, md::AbstractString)
117
- print(io, replace(md, r"[\s\t\n]+", " "))
+ print(io, replace(md, r"[\s\t\n]+" => " "))
118
119
120
function terminline(io::IO, md::Bold)
base/methodshow.jl
@@ -203,7 +203,7 @@ function url(m::Method)
203
file = string(m.file)
204
line = m.line
205
line <= 0 || ismatch(r"In\[[0-9]+\]", file) && return ""
206
- Sys.iswindows() && (file = replace(file, '\\', '/'))
+ Sys.iswindows() && (file = replace(file, '\\' => '/'))
207
if inbase(M)
208
if isempty(Base.GIT_VERSION_INFO.commit)
209
# this url will only work if we're on a tagged release
base/pkg/reqs.jl
@@ -19,7 +19,7 @@ struct Requirement <: Line
19
system::Vector{AbstractString}
20
21
function Requirement(content::AbstractString)
22
- fields = split(replace(content, r"#.*$", ""))
+ fields = split(replace(content, r"#.*$" => ""))
23
system = AbstractString[]
24
while !isempty(fields) && fields[1][1] == '@'
25
push!(system,popfirst!(fields)[2:end])
0 commit comments