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

电子商务网站建设课程标准彩票网站开发app

电子商务网站建设课程标准,彩票网站开发app,如何快速建网站,快速网站推广首页排名在 C 的 std::string 类中#xff0c;有几个成员函数可以用于在字符串中执行搜索和子字符串提取操作。以下是这些函数的简要说明#xff1a; find(): 查找子字符串的第一个出现位置。 size_t find(const string str, size_t pos 0) const; size_t find(const char* s, …在 C 的 std::string 类中有几个成员函数可以用于在字符串中执行搜索和子字符串提取操作。以下是这些函数的简要说明 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。 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。 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。 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。 substr(): 提取子字符串。 string substr(size_t pos 0, size_t len npos) const;这个函数返回从位置 pos 开始长度为 len 的子字符串副本。如果省略 len则返回从 pos 开始的剩余部分。 具体示例 #include iostream #include stringint 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://www.dnsts.com.cn/news/158054.html

相关文章:

  • 门户网站cms程序wordpress 底部栏位置
  • 兰州学校网站建设设计比较有特色的网站
  • 杭州pc网站开发公司有哪些网站加载慢怎么办
  • 如何规避电子政务门户网站建设的教训网站建设适合女生吗
  • 利用帝国cms网站建设免费装潢设计网站flash源码模版php生成html免费下载
  • 国内酒店网站建设青岛企业建设网站公司
  • 潍坊网站优化排名软文范例大全1000字
  • 网站建设页面设计图片网站建设配图
  • 英文网站建设合同给别人做网站收钱违法吗
  • 深圳营销型网站建设-龙华信科网站规划书 确定网站建设目的
  • 怎样做音视频宣传网站国内低代码平台有哪些
  • 群晖个人网站建设房地产集团网站模板
  • 互联网站源码用pageadmin做的网站用什么虚拟主机号
  • 珠海网站建设专业设计百度推广客户端下载网址
  • 网站模板库官网买网站平台名字吗
  • 微信分销网站建设哪家好wordpress 多语言设置
  • 网站建设 中企动力厨具网站开发成本报表
  • 我的网站怎么做wordpress有没有翻书的主题
  • 重庆综合网站建设配件手机端模板网站
  • 凡科的网站怎么做百度推广做竞价网站 要注意什么
  • 烟台市芝罘区建设局网站网站开发天津网站开发
  • 主机服务器网站 怎么做漂亮的学校网站模板下载
  • 做哪类视频网站需要视频证书免费的个人简历模板wps
  • 济宁三合一网站建设个人网站可以做百度推广吗
  • 自己找网站开发项目免费制作自己的网站
  • 企业网站seo从哪开始会展网站建设情况
  • 高端网站设计电话中文命名网页制作素材会怎么样
  • 跟京东类似的网站淘宝客网站WordPress
  • wordpress快站平台建设网站的流程图
  • 宝山青岛网站建设百度一下百度搜索百度一下