change swapped_case implementation
This commit is contained in:
parent
b229584e95
commit
f4e7da8826
|
@ -174,11 +174,8 @@ void replace_with_char(Context& context)
|
||||||
|
|
||||||
Codepoint swapped_case(Codepoint cp)
|
Codepoint swapped_case(Codepoint cp)
|
||||||
{
|
{
|
||||||
if ('A' <= cp and cp <= 'Z')
|
Codepoint res = std::tolower(cp);
|
||||||
return cp - 'A' + 'a';
|
return res == cp ? std::toupper(cp) : res;
|
||||||
if ('a' <= cp and cp <= 'z')
|
|
||||||
return cp - 'a' + 'A';
|
|
||||||
return cp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap_case(Context& context)
|
void swap_case(Context& context)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user