Skip to content

Commit

Permalink
deprecate cpad
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Aug 9, 2017
1 parent 676faec commit 1565093
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ Deprecated or removed
* Calling `union` with no arguments is deprecated; construct an empty set with an appropriate
element type using `Set{T}()` instead ([#23144]).

* `Base.cpad` is removed; use appropriate combination of `rpad` and `lpad` instead ([#23187]).

Julia v0.6.0 Release Notes
==========================

Expand Down
3 changes: 3 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1632,6 +1632,9 @@ function SymTridiagonal(dv::AbstractVector{T}, ev::AbstractVector{S}) where {T,S
SymTridiagonal(convert(Vector{R}, dv), convert(Vector{R}, ev))
end

# PR #23187
@deprecate cpad(s, n::Integer, p=" ") rpad(lpad(s,div(n+strwidth(s),2),p),n,p) false

# END 0.7 deprecations

# BEGIN 1.0 deprecations
Expand Down
3 changes: 2 additions & 1 deletion base/pkg/entry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,8 @@ end

function warnbanner(msg...; label="[ WARNING ]", prefix="")
cols = Base.displaysize(STDERR)[2]
warn(prefix="", Base.cpad(label,cols,"="))
str = rpad(lpad(label,div(cols+strwidth(label),2),"="),cols,"=")
warn(prefix="", str)
println(STDERR)
warn(prefix=prefix, msg...)
println(STDERR)
Expand Down
1 change: 0 additions & 1 deletion base/strings/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ julia> rpad("March",20)
```
"""
rpad(s, n::Integer, p=" ") = rpad(string(s),n,string(p))
cpad(s, n::Integer, p=" ") = rpad(lpad(s,div(n+strwidth(s),2),p),n,p)

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

0 comments on commit 1565093

Please sign in to comment.