find_first_of字符串冲突为特殊字符“|”

时间:2016-07-21 09:53:48

标签: c++ string stdstring

在下面的代码中我发现“||”在包含“|”的文本中,但它仍然表示存在?如何解决这个问题?

std::string  sInputText = "test||111";
std::string delimeter = "||";

int pos = 0;
found = sInputText.find_first_of(delimeter);
if (found == string::npos)
{

}

1 个答案:

答案 0 :(得分:0)

阅读规范......

  

在字符串中搜索与其参数中指定的任何匹配的第一个字符