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

找人做短视频网站批量查询权重

找人做短视频网站,批量查询权重,网站没被收录,网站开发学习视频文章目录 一、string相关接口1、append2、push_back3、4、insert5、erase6、replace7、find练习(1)方法1:使用find、replace(2)方法2:遍历替换 8、rfind9、find_first_of10、find_last_of11、find_first_no…

文章目录

  • 一、string相关接口
    • 1、append
    • 2、push_back
    • 3、+=
    • 4、insert
    • 5、erase
    • 6、replace
    • 7、find
      • 练习
      • (1)方法1:使用find、replace
      • (2)方法2:遍历替换
    • 8、rfind
    • 9、find_first_of
    • 10、find_last_of
    • 11、find_first_not_of
    • 12、find_last_not_of
    • 13、substr
  • 二、谢谢观看!

上一篇文章链接:string(一)
(该篇为(一)的续作)

一、string相关接口


第一个接口就不用过多介绍了,对该字符串进行追加。

1、append

在这里插入图片描述

void test04()
{string s("hello world");s.append("aaa");cout << s << endl;
}

在这里插入图片描述

2、push_back

对字符串尾插一个字符
在这里插入图片描述

void test05()
{string s("hello world");s.push_back('A');cout << s << endl;
}

在这里插入图片描述

3、+=

+= 也是用来拼接字符/字符串的,相较以上两种接口,+=更常用。

void test06()
{string s("hello world");s += 'a';s += "bbb";cout << s << endl;
}

在这里插入图片描述

4、insert

插入
在这里插入图片描述
最常用的是第一个,在pos位置插入字符串。

void test07()
{string s("hello world");s.insert(0, "w");cout << s << endl;
}

在这里插入图片描述

5、erase

删除元素
在这里插入图片描述

void test08()
{string s("hello world");s.erase(0, 1);//在第0个位置删除1个元素cout << s << endl;
}

在这里插入图片描述

void test08()
{string s("hello world");//头删s.erase(0, 1);//在第0个位置删除1个元素//尾删// s.erase(s.size() - 1, 1);s.erase(--s.end());//迭代器cout << s << endl;
}

在这里插入图片描述

6、replace

替换
在这里插入图片描述

void test09()
{string s("hello world");s.replace(0, 2, "a");//从第0个位置开始的2个字符替换为"a"cout << s << endl;
}

在这里插入图片描述

7、find

查找子字符串str在该字符串中的位置,查找成功返回该子串的首字符位置,失败返回npos
在这里插入图片描述

void test11()
{string s("hello world");cout << s.find(" ");//输出结果为:5
}

练习

练习:
将字符串中的空格全部替换为“%%”

(1)方法1:使用find、replace

void test10()
{string s("hello world  aaa bbb ccc  f");int pos = s.find(' ');while (pos != string::npos){s.replace(pos, 1, "%%");pos = s.find(' ', pos + 2);}cout << s << endl;
}

在这里插入图片描述

(2)方法2:遍历替换

void test10()
{string s("hello world  aaa bbb ccc  f");string tmp;for (auto ch : s){if (ch == ' ')tmp += "%%";elsetmp += ch;}s = tmp;cout << s << endl;
}

在这里插入图片描述

8、rfind

和find作用相同,只不过是倒着查找。
r

void test11()
{string s("hello world ddd");cout << s.rfind(" ");//输出结果为:11
}

9、find_first_of

与字符串str中任一字符进行匹配。
在这里插入图片描述

例如:将字符串s中含有a/b/c/d的字符全部修改为*

void test12()
{string s("hello world  abfg cdmn");int pos = s.find_first_of("abcd");while (pos != string::npos){s.replace(pos, 1, "*");pos = s.find_first_of("abcd", pos + 1);}cout << s << endl;
}

在这里插入图片描述

10、find_last_of

与字符串str中任一字符进行匹配,但是倒着进行查找匹配。
在这里插入图片描述

11、find_first_not_of

排除,查找字符串中非str中任一字符的下标。
在这里插入图片描述

例如:将字符串s中非a/b/c/d的字符全部修改为*

void test12()
{string s("hello world  abfg cdmn");int pos = s.find_first_not_of("abcd");while (pos != string::npos){s.replace(pos, 1, "*");pos = s.find_first_not_of("abcd", pos + 1);}cout << s << endl;
}

在这里插入图片描述

12、find_last_not_of

查找字符串中非str中任一字符的下标,但是倒着进行查找匹配。
在这里插入图片描述

13、substr

拷贝该字符串中第pos位置,长度为len的子串。
在这里插入图片描述

void test13()
{string s("hello world");cout << s.substr(6) << endl;
}

在这里插入图片描述

二、谢谢观看!

http://www.dtcms.com/a/432962.html

相关文章:

  • 门户网站app有哪些电子印章在线生成
  • 长安网站建设制作h5类作品是什么意思
  • 建设手机网站平台在重庆 那里可以做诚信网站认证
  • 企业网站备案容易吗新闻文章网站源码
  • 怎么注册网站免费的韩雪个人网站
  • 网络网站推广同城服务网站开发
  • html5网站怎么做浦江县建设局网站
  • 官方网站找工作公众号如何自己做网站优化
  • 数据结构代码复习 持续更新
  • 台州网站建设选浙江华企济南正规做网站公司
  • 如何制作私人网站预约支付wordpress
  • 做网站为什么用php桂林网站搭建
  • 微信导航网站 dedecms免费的模板网站
  • 做网站法律条文中天钢铁 网站建设
  • 做网站需求文档怎样办网站
  • 官方网站下载打印机驱动wordpress移动端导航菜单
  • 物流网站免费模板安卓app制作公司
  • 小迪web自用笔记45
  • 南京企业自助建站系统wordpress 打开速度慢
  • 做网站建设需要会哪些网站设计公司皆选奇点网络
  • 献县网站建设网络科技公司起名免费
  • 泰安放心的企业建站公司如何提高网站的点击率
  • 网站开发需要学些什么?网站建设方案及报
  • 山东省住房和城乡建设部网站首页下载爱南宁乘车
  • 如何让百度收录我的网站怎么创建网站论坛
  • 锦州网站开发招聘做搜狗网站排名软件
  • 摄影网站知乎seo关键词挖掘工具
  • 建设网站需要哪些职位二级域名查询网站
  • 网站放在服务器上网站开发中
  • 上海徐家汇网站建设优化设计答案