特殊字符派"|"的字符串冲突find_first_of

find_first_of of string conflicts for special char pie "|"

本文关键字:find of first 冲突 字符串 特殊字符      更新时间:2023-10-16

在下面的代码中,我在一个包含"|"的文本中找到了"||",但它仍然说它存在?如何解决这个问题?

std::string  sInputText = "test||111";
std::string delimeter = "||";
int pos = 0;
found = sInputText.find_first_of(delimeter);
if (found == string::npos)
{
}

阅读规范…

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