Skip to content

Commit 01dd35a

Browse files
authored
deprecate cpad (#23187)
1 parent 4e471fe commit 01dd35a

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ Deprecated or removed
299299
* Calling `union` with no arguments is deprecated; construct an empty set with an appropriate
300300
element type using `Set{T}()` instead ([#23144]).
301301

302+
* `Base.cpad` has been removed; use an appropriate combination of `rpad` and `lpad`
303+
instead ([#23187]).
304+
302305
Julia v0.6.0 Release Notes
303306
==========================
304307

base/deprecated.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,6 +1642,9 @@ end
16421642
end
16431643
end
16441644

1645+
# PR #23187
1646+
@deprecate cpad(s, n::Integer, p=" ") rpad(lpad(s, div(n+strwidth(s), 2), p), n, p) false
1647+
16451648
# END 0.7 deprecations
16461649

16471650
# BEGIN 1.0 deprecations

base/pkg/entry.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,8 @@ end
572572

573573
function warnbanner(msg...; label="[ WARNING ]", prefix="")
574574
cols = Base.displaysize(STDERR)[2]
575-
warn(prefix="", Base.cpad(label,cols,"="))
575+
str = rpad(lpad(label, div(cols+strwidth(label), 2), "="), cols, "=")
576+
warn(prefix="", str)
576577
println(STDERR)
577578
warn(prefix=prefix, msg...)
578579
println(STDERR)

base/strings/util.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ julia> rpad("March",20)
256256
```
257257
"""
258258
rpad(s, n::Integer, p=" ") = rpad(string(s),n,string(p))
259-
cpad(s, n::Integer, p=" ") = rpad(lpad(s,div(n+strwidth(s),2),p),n,p)
260259

261260
# splitter can be a Char, Vector{Char}, AbstractString, Regex, ...
262261
# any splitter that provides search(s::AbstractString, splitter)

0 commit comments

Comments
 (0)