博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
string
阅读量:4519 次
发布时间:2019-06-08

本文共 625 字,大约阅读时间需要 2 分钟。

string str = "sdfsdfsd1234fsdf";    cout << str.size() << endl;    cout << str.insert(str.size(), "123") << endl;    cout << str.find("123") << endl;    cout << str.substr(0, 4) << endl;    cout << str.append("456") << endl;    //resize 元素预留空间,并没有真正的创建,可以通过push insert 的方式添加    str.reserve(50);    cout << "size :" << str.size() << endl;    // resize 则为实际扩充空间大小    str.resize(50);    cout << "size :" << str.size() << endl;    string str1 = "我爱中国";    cout << str1.size() << endl;    cout << str1.length() << endl;    // 当前机器最大string最大长度    cout << str1.max_size() << endl;

 

转载于:https://www.cnblogs.com/alplf123/p/8004339.html

你可能感兴趣的文章
springboot访问项目中某个module的图片(服务器拿不到)
查看>>
[P1329] 数列
查看>>
Research on How Tradeshow Magician Works
查看>>
LINUX 配置网络
查看>>
一个不错的git资源站点
查看>>
收缩数据库
查看>>
01_8_session
查看>>
HDU 2054 A==B? 大数
查看>>
在GNU Linux中怎样得到一个进程当前的流量
查看>>
openwrt的CBI控件简单说明
查看>>
Objective-C Category
查看>>
关于app目录的一些整理
查看>>
人什么时候才能长大
查看>>
一步步学敏捷开发:开篇
查看>>
Notepad++中常用的插件
查看>>
分布式缓存系统 Memcached 整体架构
查看>>
js amd
查看>>
数据类型
查看>>
CDOJ_844 程序设计竞赛
查看>>
003_代码发布系统实现
查看>>