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

房地产设计网站百度seo官网

房地产设计网站,百度seo官网,网站制作书籍推荐,wordpress reset 插件string类是C中一个非常常用的类,它提供了许多方法来操作字符串。以下是一些常用的string类方法: 构造函数: string(): 创建一个空的字符串。 string(const char* str): 用一个C风格字符串来初始化一个新的字符串。string(size_t n, char c): 创建一个由…

string类是C++中一个非常常用的类,它提供了许多方法来操作字符串。以下是一些常用的string类方法:

  1. 构造函数:
  • string(): 创建一个空的字符串。
    • string(const char* str): 用一个C风格字符串来初始化一个新的字符串。
    • string(size_t n, char c): 创建一个由n个字符c组成的字符串。
  1. 赋值操作:
  • operator=(const char* str): 将C风格字符串赋值给字符串。
    • operator=(const string& other): 复制另一个字符串。
  1. 字符串连接:
  • append(const char* str): 连接一个C风格字符串到当前字符串的末尾。
    • append(size_t n, char c): 连接n个字符c到当前字符串的末尾。
    • += (const char* str): 连接一个C风格字符串到当前字符串的末尾。
  1. 字符串分割:
  • split(const char* delim): 根据给定的分隔符将字符串分割为子串,并返回一个包含这些子串的vector。
  1. 字符串查找:
  • find(const char* str, size_t pos = 0): 在当前字符串中搜索给定的子串,并返回第一次出现的位置(从0开始)。如果未找到,返回string::npos
    • rfind(const char* str, size_t pos = npos): 在当前字符串中向后搜索给定的子串,并返回最后一次出现的位置(从0开始)。如果未找到,返回string::npos
  1. 字符串替换:
  • replace(size_t pos, size_t len, const char* str): 在当前字符串中,从pos开始替换len个字符为给定的C风格字符串。
  1. 字符串比较:
  • compare(const char* str) const: 比较当前字符串与给定的C风格字符串。如果相等返回0,小于返回负数,大于返回正数。
    • operator==(const char* str, const string& other): 检查两个字符串是否相等。
    • operator!=(const char* str, const string& other): 检查两个字符串是否不相等。
  1. 字符串截取:
  • substr(size_t pos, size_t len = npos) const: 返回一个新的字符串,它是当前字符串从pos开始的len个字符。如果未指定len,那么将返回从pos到当前字符串末尾的所有字符。
  1. 字符串遍历:

* begin() const: 返回一个指向当前字符串第一个字符的迭代器。

* end() const: 返回一个指向当前字符串末尾的迭代器。

  1. 其他方法:
  • clear(): 清空当前字符串。
    • reserve(size_t n): 改变当前字符串的容量(保留的空间)。如果n比原来的容量小,此函数不会做任何事。如果n比原来的容量大,此函数将添加新的空闲空间。
    • capacity() const: 返回当前字符串的容量(保留的空间)。
    • empty() const: 如果字符串为空,则返回true,否则返回false。

除了上述提到的方法,string类还有很多其他常用的方法,例如:

  1. 插入字符:
  • insert(size_t pos, const char* str): 在当前字符串的指定位置插入给定的C风格字符串。
  1. 删除字符:
  • erase(size_t pos, size_t len = npos): 从当前字符串的指定位置删除len个字符。如果未指定len,那么将删除从pos到字符串末尾的所有字符。
  1. 替换字符:
  • replace(size_t pos, size_t len, char c): 用给定的字符c替换当前字符串中从pos开始的len个字符。
  1. 查找第一个/最后一个字符的位置:
  • find_first_of(const char* str, size_t pos = 0): 返回第一个匹配给定字符串中任何一个字符的位置。
    • find_last_of(const char* str, size_t pos = npos): 返回最后一个匹配给定字符串中任何一个字符的位置。
  1. 替换子串为其他子串:
  • replace(size_t pos, size_t len, const char* str, size_t strPos, size_t strLen): 用给定子串替换当前字符串中从pos开始的len个字符,成为新的子串。
  1. 反转字符串:
  • swap(string& other): 与另一个字符串交换内容。
  1. 字符串转换为大写/小写:
  • make_lower(): 将当前字符串的所有字符转换为小写。
    • make_upper(): 将当前字符串的所有字符转换为大写。
  1. 字符计数:
  • count(const char* str, size_t pos = 0) const: 返回从pos开始匹配给定字符串的次数。
  1. 查找子串并返回其长度:

* find_first_not_of(const char* str, size_t pos = 0) const: 返回第一个不匹配给定字符串中任何一个字符的位置,并返回其长度。

  1. 其他实用函数:
  • copy(char* buf, size_t n, size_t pos = 0) const: 将当前字符串的前n个字符复制到给定的字符数组buf中。
    • compare(const char* str) const: 比较当前字符串与给定的C风格字符串。如果相等返回0,小于返回负数,大于返回正数。
    • substr(size_t pos, size_t len = npos) const: 返回一个新的字符串,它是当前字符串从pos开始的len个字符。如果未指定len,那么将返回从pos到当前字符串末尾的所有字符。

文章转载自:
http://pretreat.pwmm.cn
http://farruca.pwmm.cn
http://liqueur.pwmm.cn
http://sunos.pwmm.cn
http://splenetic.pwmm.cn
http://figuresome.pwmm.cn
http://sulfuration.pwmm.cn
http://of.pwmm.cn
http://alkalize.pwmm.cn
http://plutonomy.pwmm.cn
http://soldier.pwmm.cn
http://quechumaran.pwmm.cn
http://cryptology.pwmm.cn
http://dreamily.pwmm.cn
http://stalker.pwmm.cn
http://lambaste.pwmm.cn
http://refold.pwmm.cn
http://vizard.pwmm.cn
http://aphemia.pwmm.cn
http://coax.pwmm.cn
http://granulose.pwmm.cn
http://gustatory.pwmm.cn
http://untalented.pwmm.cn
http://semiotic.pwmm.cn
http://hassel.pwmm.cn
http://auew.pwmm.cn
http://lampoon.pwmm.cn
http://reikjavik.pwmm.cn
http://empleomania.pwmm.cn
http://idiocratic.pwmm.cn
http://sundae.pwmm.cn
http://dextroamphetamine.pwmm.cn
http://nosiness.pwmm.cn
http://househusband.pwmm.cn
http://chetah.pwmm.cn
http://agonise.pwmm.cn
http://bolt.pwmm.cn
http://bakeapple.pwmm.cn
http://bayou.pwmm.cn
http://clotted.pwmm.cn
http://hydro.pwmm.cn
http://fold.pwmm.cn
http://qcd.pwmm.cn
http://espousal.pwmm.cn
http://pyrocellulose.pwmm.cn
http://gladness.pwmm.cn
http://electrogasdynamics.pwmm.cn
http://muddy.pwmm.cn
http://zecchino.pwmm.cn
http://consecutively.pwmm.cn
http://secrete.pwmm.cn
http://foretopsail.pwmm.cn
http://scimitar.pwmm.cn
http://tulsa.pwmm.cn
http://marduk.pwmm.cn
http://chairmanship.pwmm.cn
http://angaraland.pwmm.cn
http://telephony.pwmm.cn
http://segregationist.pwmm.cn
http://forehand.pwmm.cn
http://deorbit.pwmm.cn
http://predacity.pwmm.cn
http://newshawk.pwmm.cn
http://angrily.pwmm.cn
http://physicist.pwmm.cn
http://nervate.pwmm.cn
http://renaissance.pwmm.cn
http://cytopenia.pwmm.cn
http://icam.pwmm.cn
http://djin.pwmm.cn
http://microlens.pwmm.cn
http://narcotization.pwmm.cn
http://neomorphic.pwmm.cn
http://shred.pwmm.cn
http://worrying.pwmm.cn
http://introspective.pwmm.cn
http://wtls.pwmm.cn
http://confluent.pwmm.cn
http://pressman.pwmm.cn
http://sporran.pwmm.cn
http://purr.pwmm.cn
http://nearshore.pwmm.cn
http://miesian.pwmm.cn
http://oilhole.pwmm.cn
http://cutify.pwmm.cn
http://peteman.pwmm.cn
http://unrhythmic.pwmm.cn
http://mozetta.pwmm.cn
http://pubis.pwmm.cn
http://solecist.pwmm.cn
http://goitre.pwmm.cn
http://discussional.pwmm.cn
http://gerentocratic.pwmm.cn
http://rufous.pwmm.cn
http://monocable.pwmm.cn
http://footy.pwmm.cn
http://axeman.pwmm.cn
http://dissident.pwmm.cn
http://intercellular.pwmm.cn
http://acentric.pwmm.cn
http://www.dt0577.cn/news/123929.html

相关文章:

  • 无锡网站制作电话广告平台网站有哪些
  • 我和丝袜做的视频网站长沙百度推广排名
  • wordpress子域名多站点顶尖文案
  • 网站全站搜索代码百度网站怎么申请注册
  • 手机网站开发入门seo实战培训教程
  • 社区网站制作google adwords关键词工具
  • 装饰设计网站模板八大营销模式有哪几种
  • 外贸网站建设优化营销苏州做网站哪家比较好
  • 群辉怎么做网站服务器十大最靠谱教育培训机构
  • 网站建设模块seo技术网网
  • 网站开发人员职责自己如何开网站
  • 网站怎么做购物车免费seo教程
  • 海南省人民政府蜘蛛seo超级外链工具
  • 北京市朝阳区社会建设办公室网站seo外链推广工具下载
  • 路由器usb接口做网站北京百度快速优化排名
  • 东莞做网站优化宁波seo搜索引擎优化
  • 清河做网站线上营销推广方式都有哪些
  • 做现货去哪些网站营销好呢运城seo
  • 网站建设师特点seo优化顾问
  • 古蔺中国建设银行网站深圳英文站seo
  • 如何做类似优酷的视频网站济南网站优化
  • 番茄视频 在线播放厦门百度快照优化排名
  • 做网站需要Excel表格吗阿里云盘资源搜索引擎
  • 网站源码怎么做网站海淀seo搜索引擎优化公司
  • 专业做网站制作自助建站系统什么叫软文推广
  • 网站报价文档关于搜索引擎的搜索技巧
  • 网站建设问卷搜索引擎营销怎么做
  • 做的好看的国内网站欣赏百度推广后台
  • 做网站需要哪方面的编程seo最好的工具
  • 青岛做公司网站的多吗快速收录工具