From 7c3bbc24e3fca00a950fef71505d0e67287f099e Mon Sep 17 00:00:00 2001 From: ScottPJones Date: Thu, 4 Oct 2018 01:21:34 -0400 Subject: [PATCH] Uppercase fixes --- Project.toml | 2 +- REQUIRE | 2 +- src/casefold.jl | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index d23046e..24da0a8 100644 --- a/Project.toml +++ b/Project.toml @@ -4,7 +4,7 @@ keywords = ["Characters"] license = "MIT" desc = "Basic functionality for Chr type" authors = ["ScottPJones "] -version = "0.1.7" +version = "0.1.8" [deps] Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" diff --git a/REQUIRE b/REQUIRE index 4500ecb..3a9eeb2 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,4 +1,4 @@ julia 0.6 2- ModuleInterfaceTools 0.1.6 -StrAPI 0.1.7 +StrAPI 0.1.8 CharSetEncodings 0.1.8 diff --git a/src/casefold.jl b/src/casefold.jl index 5daaa1b..ffafd76 100644 --- a/src/casefold.jl +++ b/src/casefold.jl @@ -25,7 +25,9 @@ uppercase(ch::ASCIIChr) = _islower_a(ch) ? ASCIIChr(ch - 0x20) : ch titlecase(ch::ASCIIChr) = uppercase(ch) lowercase(ch::T) where {T<:LatinChars} = T(_lowercase_l(codepoint(ch))) -uppercase(ch::LatinChr) = LatinChr(_uppercase_l(codepoint(ch))) + +_uppercase_latin(ch) = _can_upper(ch) ? ch - 0x20 : ch +uppercase(ch::LatinChr) = LatinChr(_uppercase_latin(codepoint(ch))) # Special handling for case where this is just an optimization of the first 256 bytes of Unicode, # and not the 8-bit ISO 8859-1 character set