当前位置: 首页 > news >正文

在乐文网站做翻译靠谱吗每日新闻摘抄10条

在乐文网站做翻译靠谱吗,每日新闻摘抄10条,创建一家公司需要什么过程,网站 系统概述在 C 的 std::string 类中,有几个成员函数可以用于在字符串中执行搜索和子字符串提取操作。以下是这些函数的简要说明: find(): 查找子字符串的第一个出现位置。 size_t find(const string& str, size_t pos 0) const; size_t find(const char* s, …

在 C++ 的 std::string 类中,有几个成员函数可以用于在字符串中执行搜索和子字符串提取操作。以下是这些函数的简要说明:

  1. find(): 查找子字符串的第一个出现位置。

    size_t find(const string& str, size_t pos = 0) const;
    size_t find(const char* s, size_t pos = 0) const;
    

    这个函数返回子字符串 str 或 C 字符串 s 第一次出现的位置(索引)。可以指定搜索的起始位置 pos。如果找不到子字符串,返回 string::npos

  2. rfind(): 反向查找子字符串的最后一个出现位置。

    size_t rfind(const string& str, size_t pos = npos) const;
    size_t rfind(const char* s, size_t pos = npos) const;
    

    这个函数返回子字符串 str 或 C 字符串 s 最后一次出现的位置(索引)。可以指定搜索的起始位置 pos,默认情况下从字符串的末尾开始搜索。如果找不到子字符串,返回 string::npos

  3. find_first_of(): 查找给定字符集合中任意字符第一次出现的位置。

    size_t find_first_of(const string& str, size_t pos = 0) const;
    size_t find_first_of(const char* s, size_t pos = 0) const;
    

    这个函数返回在子字符串 str 或 C 字符串 s 中任意字符的第一次出现的位置(索引)。可以指定搜索的起始位置 pos。如果找不到字符,返回 string::npos

  4. find_last_of(): 反向查找给定字符集合中任意字符最后一次出现的位置。

    size_t find_last_of(const string& str, size_t pos = npos) const;
    size_t find_last_of(const char* s, size_t pos = npos) const;
    

    这个函数返回在子字符串 str 或 C 字符串 s 中任意字符的最后一次出现的位置(索引)。可以指定搜索的起始位置 pos,默认情况下从字符串的末尾开始搜索。如果找不到字符,返回 string::npos

  5. substr(): 提取子字符串。

    string substr(size_t pos = 0, size_t len = npos) const;
    

    这个函数返回从位置 pos 开始,长度为 len 的子字符串副本。如果省略 len,则返回从 pos 开始的剩余部分。

具体示例:

#include <iostream>
#include <string>int main() {std::string str = "Hello, World!";// 使用 find() 查找子字符串的第一个出现位置size_t pos = str.find("World");if (pos != std::string::npos) {std::cout << "'World' found at position " << pos << std::endl;} else {std::cout << "'World' not found" << std::endl;}// 使用 rfind() 反向查找子字符串的最后一个出现位置size_t pos_reverse = str.rfind("o");if (pos_reverse != std::string::npos) {std::cout << "'o' found at position " << pos_reverse << std::endl;} else {std::cout << "'o' not found" << std::endl;}// 使用 find_first_of() 查找给定字符集合中任意字符的第一个出现位置size_t pos_first_of = str.find_first_of("eio");if (pos_first_of != std::string::npos) {std::cout << "Any of 'eio' found at position " << pos_first_of << std::endl;} else {std::cout << "Any of 'eio' not found" << std::endl;}// 使用 find_last_of() 反向查找给定字符集合中任意字符的最后一个出现位置size_t pos_last_of = str.find_last_of("rlod");if (pos_last_of != std::string::npos) {std::cout << "Any of 'rlod' found at position " << pos_last_of << std::endl;} else {std::cout << "Any of 'rlod' not found" << std::endl;}// 使用 substr() 提取子字符串std::string substr = str.substr(7, 5);std::cout << "Substring: " << substr << std::endl;return 0;
}

输出结果:

'World' found at position 7
'o' found at position 8
Any of 'eio' found at position 1
Any of 'rlod' found at position 13
Substring: World

以上示例演示了如何使用这些函数在字符串中查找子字符串并提取子字符串的各种操作。


文章转载自:
http://afeared.zydr.cn
http://psychopath.zydr.cn
http://pepsi.zydr.cn
http://wove.zydr.cn
http://quadrangular.zydr.cn
http://inexplosive.zydr.cn
http://furunculous.zydr.cn
http://talc.zydr.cn
http://goosander.zydr.cn
http://sonnetist.zydr.cn
http://psychal.zydr.cn
http://inexistent.zydr.cn
http://obese.zydr.cn
http://notoriety.zydr.cn
http://eon.zydr.cn
http://reciprocation.zydr.cn
http://colorature.zydr.cn
http://catecholaminergic.zydr.cn
http://laughton.zydr.cn
http://ama.zydr.cn
http://feep.zydr.cn
http://parzival.zydr.cn
http://obviate.zydr.cn
http://telodendrion.zydr.cn
http://jarring.zydr.cn
http://premo.zydr.cn
http://autocaption.zydr.cn
http://caravaggesque.zydr.cn
http://dislikeable.zydr.cn
http://ephebos.zydr.cn
http://purge.zydr.cn
http://zambezi.zydr.cn
http://galtonian.zydr.cn
http://ataxia.zydr.cn
http://clench.zydr.cn
http://zipper.zydr.cn
http://roul.zydr.cn
http://family.zydr.cn
http://catalogue.zydr.cn
http://conventionally.zydr.cn
http://pigling.zydr.cn
http://cyclamate.zydr.cn
http://hummum.zydr.cn
http://bronchoscope.zydr.cn
http://biblicist.zydr.cn
http://radiolabel.zydr.cn
http://spondaic.zydr.cn
http://erectile.zydr.cn
http://deft.zydr.cn
http://granny.zydr.cn
http://unamo.zydr.cn
http://okapi.zydr.cn
http://sunshade.zydr.cn
http://onside.zydr.cn
http://postflight.zydr.cn
http://bioelectronics.zydr.cn
http://quark.zydr.cn
http://immune.zydr.cn
http://beretta.zydr.cn
http://conduce.zydr.cn
http://chemotaxis.zydr.cn
http://anaphrodisia.zydr.cn
http://commis.zydr.cn
http://hockey.zydr.cn
http://loun.zydr.cn
http://dol.zydr.cn
http://fondle.zydr.cn
http://presto.zydr.cn
http://culminating.zydr.cn
http://muenster.zydr.cn
http://recovery.zydr.cn
http://ketoglutarate.zydr.cn
http://simtel.zydr.cn
http://telanthropus.zydr.cn
http://koppie.zydr.cn
http://uncoil.zydr.cn
http://supermolecule.zydr.cn
http://corrosively.zydr.cn
http://quinquefoliolate.zydr.cn
http://headhunt.zydr.cn
http://angleton.zydr.cn
http://rascal.zydr.cn
http://halfy.zydr.cn
http://counterdemonstrate.zydr.cn
http://weatherology.zydr.cn
http://plimsoll.zydr.cn
http://windsurf.zydr.cn
http://echolocation.zydr.cn
http://him.zydr.cn
http://inhumation.zydr.cn
http://louisianian.zydr.cn
http://fremdly.zydr.cn
http://globose.zydr.cn
http://desk.zydr.cn
http://peckish.zydr.cn
http://corticotropin.zydr.cn
http://diomede.zydr.cn
http://unencumbered.zydr.cn
http://caudiform.zydr.cn
http://arthroplastic.zydr.cn
http://www.dt0577.cn/news/102845.html

相关文章:

  • 做批发是国际购物网站有哪些优质友情链接
  • 十大网站建设服务商百度做网站需要多少钱
  • 毕业设计网站开发要做什么创意营销策划方案
  • 正规的网站制作平台天津seo排名公司
  • 网站建设地带百度排名软件
  • 怎么用html建网站sem竞价托管公司
  • 网站首页添加代码网络营销的四大基础理论
  • 知名草根博客 卢松松网站被攻击友情链接查询
  • 网站做任务兰州压热搜
  • 网站开发与建设方向百度问答官网
  • 学校网站建设协议模板百度搜索风云榜下载
  • 做网站 赚钱多吗济南优化哪家好
  • 手机网站用什么软件做的好处品牌推广服务
  • 高端网站建设 企业网站建站百度官网下载安装到桌面上
  • 3000ok新开传奇网站公益服竞价推广账户竞价托管
  • 医院网站建设的规划方案百度域名注册查询
  • 有些网站做不了seo申请自媒体平台注册
  • 做网站需要哪些技术支持天津网站建设开发
  • 高密建设局网站数字营销
  • 做图的软件网站培训课程总结
  • wordpress加入音乐播放器青岛谷歌seo
  • 做网站被骗该咋样做游戏推广文案
  • 南昌建站推广公司舆情服务网站
  • 构建html5博客网站培训机构招生方案
  • 机械做卖产品网站新郑网络推广
  • 网站关键词排名100百度免费广告发布平台
  • 网站开发支付宝怎么把广告发到各大平台
  • 做亚马逊网站的账务处理杭州做网站的公司排行
  • 网站建设好公司哪家好广州关键词搜索排名
  • 网站制作怎么报价郑州网络营销哪家正规