【问题标题】:find_first_of of string conflicts for special char pie "|"find_first_of 特殊字符派“|”的字符串冲突
【发布时间】:2016-07-21 09:53:47
【问题描述】:

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

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

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

}

【问题讨论】:

  • std::string sInputText = "test|111"; std::string 分隔符 = "||";整数位置 = 0; found = sInputText.find_first_of(demeter); if (found == string::npos) { }

标签: c++ string stdstring


【解决方案1】:

阅读规范......

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-12
    • 1970-01-01
    • 1970-01-01
    • 2011-09-18
    • 2019-02-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多