【发布时间】:2010-11-18 08:39:55
【问题描述】:
我正在尝试使用提升字符串算法进行不区分大小写的搜索。
这里是新手。
如果我以这种方式使用它,我会收到错误。
std::string str1("Hello world");
std::string str2("hello");
if ( boost::ifind_first(str1, str2) ) some code;
转换为 char 指针可以解决问题。
boost::ifind_first( (char*)str1.c_str(), (char*)str2.c_str() );
有没有办法直接搜索 std::string 对象?
另外,也许还有另一种方法可以通过不区分大小写的搜索来知道字符串是否存在于另一个字符串中?
【问题讨论】:
标签: c++ algorithm string boost