utils: add ascii ctype helpers
Add some constexpr ctype helpers that avoid any possible UB (i.e., handling casting to unsigned), and explicitly avoid any locale-specifics.
This commit is contained in:
@ -269,7 +269,7 @@ Mu::remove_ctrl(const std::string& str)
|
||||
result.reserve(str.length());
|
||||
|
||||
for (auto&& c : str) {
|
||||
if (::iscntrl(c) || c == ' ') {
|
||||
if (is_ascii_cntrl(c) || c == ' ') {
|
||||
if (prev != ' ')
|
||||
result += prev = ' ';
|
||||
} else
|
||||
|
||||
Reference in New Issue
Block a user