diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-04-17 19:31:31 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-04-17 19:31:31 +0200 |
| commit | f4e7da8826d0bcf4b06ab3cb785089e9fbc51b70 (patch) | |
| tree | 78dd6fa0a7923587d0eac102c061a532b59c1d65 /src/normal.cc | |
| parent | b229584e95c1997968bca84c37a283293db7ce1f (diff) | |
change swapped_case implementation
Diffstat (limited to 'src/normal.cc')
| -rw-r--r-- | src/normal.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/normal.cc b/src/normal.cc index b41561e3..ff30fa2b 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -174,11 +174,8 @@ void replace_with_char(Context& context) Codepoint swapped_case(Codepoint cp) { - if ('A' <= cp and cp <= 'Z') - return cp - 'A' + 'a'; - if ('a' <= cp and cp <= 'z') - return cp - 'a' + 'A'; - return cp; + Codepoint res = std::tolower(cp); + return res == cp ? std::toupper(cp) : res; } void swap_case(Context& context) |
