C++中substr函数的用法
来源:互联网 发布:嘉兴旅游攻略知乎 编辑:程序博客网 时间:2024/05/16 08:51
int main(){string str1("Heterological paradoxes are persistent.");cout << "str1 is:" << endl;cout << str1 << endl;basic_string<char>str2 = str1.substr(6, 7);cout << "str2 is:" << str2 << endl;basic_string<char>str3 = str1.substr();cout << "str3 is:" << endl;cout << str3 << endl;basic_string<char>str4 = str1.substr(6);cout << "str4 is:" << endl;cout << str4 << endl;return 0;}
结果是
str1.substr(6, 7)
<span style="font-family: Arial; background-color: rgb(255, 255, 255);">str1.substr(6,7)获得字符串str1中 从第6位开始的长度为7的字符串,</span>
str3 = str1.substr();//<span style="font-family: Arial; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">而 默认时的长度为从开始位置到尾</span>
str4 = str1.substr(6);//获得从该位置开始的字符串
0 0
- oracle中substr函数的用法
- oracle中substr函数的用法
- oracle中substr函数的用法
- oracle中substr函数的用法
- oracle中substr函数的用法
- oracle中substr函数的用法
- C++中substr函数的用法
- oracle中substr函数的用法
- oracle中substr函数的用法
- oracle中substr函数的用法
- oracle中substr函数的用法
- C++中substr函数的用法
- C++中substr函数的用法
- C++中substr函数的用法
- C++中substr函数的用法
- C++中substr函数的用法
- C++中substr函数的用法
- C++中substr函数的用法
- java琐碎的知识
- android自定义View
- linphone-LinphoneChatMessageImpl文件对应的JNI层文件分析
- 5-1 数列求和-加强版
- Spark 中Accumulators 和 Broadcast Variables的使用
- C++中substr函数的用法
- 18 个锻炼编程技能的网站
- C++模板和容器的介绍
- Android 屏幕适配方案
- ios支付宝支付--看我就够了
- shell 脚本程序中空格 $符号的使用
- POJ 1681 Painter's Problem(高斯消元)
- maven依赖关系中Scope的作用
- linphone-LinphoneChatRoomImpl文件对应的JNI层文件分析