Skip to content

Commit

Permalink
add Unicode.isassigned and Unicode.normalize to Compat.Unicode (#507)
Browse files Browse the repository at this point in the history
* add Unicode.isassigned and Unicode.normalize to Compat.Unicode

* explicitly import isassigned, normalize on 0.7
  • Loading branch information
stevengj authored Mar 1, 2018
1 parent ded38e5 commit 98db2e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,9 @@ module Unicode
end

isnumeric(c::Char) = isnumber(c)
isassigned(c) = is_assigned_char(c)
normalize(s::AbstractString; kws...) = normalize_string(s; kws...)
normalize(s::AbstractString, nf::Symbol) = normalize_string(s, nf)

# 0.6.0-dev.1404 (https://github.com/JuliaLang/julia/pull/19469)
if !isdefined(Base, :titlecase)
Expand All @@ -1058,6 +1061,7 @@ module Unicode
end
else
using Unicode
import Unicode: isassigned, normalize # not exported from Unicode module due to conflicts
end
end

Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,9 @@ module Test25021
@test !isnumeric('a')
@test isnumeric('1')
@test titlecase("firstname lastname") == "Firstname Lastname"
@test Compat.Unicode.isassigned('') && !Compat.Unicode.isassigned(0xfffe)
@test Compat.Unicode.normalize("\U1e9b\U0323", :NFKC) == "\U1e69"
@test Compat.Unicode.normalize("\t\r", stripcc=true) == " "
end

# 0.7.0-DEV.2951
Expand Down

0 comments on commit 98db2e5

Please sign in to comment.