美文网首页
字符串操作

字符串操作

作者: zjh3029 | 来源:发表于2017-09-28 22:20 被阅读0次

1.判断句子中是否同时含有多个字符串:

bool findstr_and(string str_org,initializer_list<string> lst)
{
    
    for (auto i = lst.begin(); i != lst.end();i++)
    {
        if (str_org.find(*i) == str_org.npos)
        {
            return false;
        }
    }
    return true;
}

bool findstr_or(string str_org, initializer_list<string> lst)
{

    for (auto i = lst.begin(); i != lst.end(); i++)
    {
        if (str_org.find(*i) != str_org.npos)
        {
            return true;
        }
    }
    return false;
}

相关文章

  • Python字符串高端操作

    字符串骚操作 字符串优雅操作

  • Python初学(十)

    这章学习下字符串的操作。 字符串的操作 字符串操作符: 针对字符串,Python语言提供了几个基本操作符 字符串处...

  • python 字符串

    字符串操作 + 字符串连接操作 * 字符串复制操作 [] 字符串索引 通过索引访问指定位置的字符,索引从头(0)...

  • Python基础-day06

    list ​ 字符串操作 ​ 字典操作 ​ list操作 字符串操作 编码解码 计算机存储数据使用的是...

  • python函数知识归纳笔记(2)

    字符串相关操作 字符串连接 字符串赋值 [索引值] 字符串通过索引访问位置 从0开始 [::] 字符串取片操作,实...

  • C++之string

    字符串构造和赋值操作 实例 存取字符 实例 字符串拼接操作 实例 字符串查找和替换 实例 字符串比较 实例 字符串...

  • 05-字符串的操作

    字符串的操作方法 [] 字符串索引操作,通过索引访问指定位置的字符,索引从0开始 [::] 字符串取片操作完整格式...

  • Python常用语法二

    Python 字符串操作和文件操作以及其它Python能力补充 Python字符串操作 in和not in: 'x...

  • 【前端】常用的JS知识点整理

    操作数组 操作字符串

  • go strings 和strconv 字符串操作

    strings 字符串操作 strconv 字符串转换 实现基本数据类型转换为 字符串的操作Append 系列...

网友评论

      本文标题:字符串操作

      本文链接:https://www.haomeiwen.com/subject/rohvextx.html