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.
函数的等价物是什么,strcmpi()对于C++ 风格的字符串?strncmp()strncmpi()
strcmpi()
strncmp()
strncmpi()
请不要建议使用诸如此类的东西strcmpi(str1.c_str, str2.c_str)。
strcmpi(str1.c_str, str2.c_str)
提前感谢您的帮助。
如果您使用的是 Boost,您可以使用它来进行不区分大小写的比较:
#include <boost/algorithm/string.hpp> std::string str1 = "hello, world!"; std::string str2 = "hELLO, World!"; if (boost::iequals(str1, str2)) { // Strings are identical }