substr()用法

知识点链接:http://www.cplusplus.com/reference/string/string/substr/

注意:

std::string str2 = str.substr (pos,len);        /*从下标为pos处找出长度为len的字串*/
std::string str3 = str.substr (pos);    /*这个是指从pos位置一直到最后*/
/*pos可以看成是下标*/
posted @ 2019-05-01 08:12  DIY-Z  阅读(171)  评论(0编辑  收藏  举报