Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我用什么来对两个 UTF-8 编码的子字符串执行不区分大小写的比较?本质上,我正在寻找strnicmpUTF-8 的函数。
strnicmp
各种 Unicode 脚本中的大小写转换规则非常困难,它需要很大的大小写转换表。你自己做不到这一点,你需要一个图书馆。ICU就是其中之一。
strcoll至少如果它是语言环境的默认编码,则应该了解语言环境并正确处理 UTF8。如果不是,我仍然不知道。就像解决方法一样,您可以将多字节字符串转换为 wchars (mbrtowc),然后使用 wcscasecmp,不幸的是它是 GNU 扩展,不是标准库的一部分……也许没那么有用。
strcoll