STL——substr


https://blog.csdn.net/ch_vaniteux/article/details/79247061

string str(tobeornottobe);

string ptr;

ptr = str.substr(4, 5);

cout << ptr;

输出的结果是ornot

可以说,substr是一个给定起点和截取长度,截出字符串中一段的函数

如果substr(4)就会是ornottobe 即到结尾


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM