--- nono/lib/mystring.cpp 2026/04/29 17:05:47 1.1.1.8 +++ nono/lib/mystring.cpp 2026/04/29 17:05:52 1.1.1.9 @@ -9,6 +9,7 @@ // #include "mystring.h" +#include "ascii_ctype.h" #include std::string @@ -32,7 +33,7 @@ string_ltrim(const std::string& str) { auto it = str.begin(); for (; it != str.end(); it++) { - if (!isspace(*it)) + if (!is_ascii_space(*it)) break; } return std::string(it, str.end()); @@ -42,7 +43,7 @@ string_ltrim(const std::string& str) void string_rtrim(std::string& str) { - while (isspace(*str.rbegin())) { + while (is_ascii_space(*str.rbegin())) { str.pop_back(); } } @@ -52,7 +53,7 @@ void rtrim(char *str) { char *p = strchr(str, '\0'); - while (--p >= str && isspace((int)*p)) { + while (--p >= str && is_ascii_space(*p)) { *p = '\0'; } } @@ -65,11 +66,11 @@ string_trim(const std::string& str) int e = str.size(); for (; s < e; s++) { - if (!isspace(str[s])) + if (!is_ascii_space(str[s])) break; } for (e--; e >= s; e--) { - if (!isspace(str[e])) + if (!is_ascii_space(str[e])) break; }