12 int to_upper(const char ch
)
14 using char8_traits
= std::char_traits
<char>;
15 return std::toupper(char8_traits::to_int_type(ch
));
22 int strcasecmp(const char *str0
, const char *str1
) noexcept
25 const int diff
{to_upper(*str0
) - to_upper(*str1
)};
26 if(diff
< 0) return -1;
27 if(diff
> 0) return 1;
28 } while(*(str0
++) && *(str1
++));
32 int strncasecmp(const char *str0
, const char *str1
, std::size_t len
) noexcept
37 const int diff
{to_upper(*str0
) - to_upper(*str1
)};
38 if(diff
< 0) return -1;
39 if(diff
> 0) return 1;
40 } while(--len
&& *(str0
++) && *(str1
++));