C++substr方法返回的是新字符串

Returns a newly constructed string object with its value initialized to a copy of a substring of this object.
The substring is the portion of the object that starts at character position pos and spans len characters (or until the end of the string, whichever comes first).

原先31行是按38行那么写的,s怎么都不变,substr函数返回的是新的字符串当然不会变啦。

在这里插入图片描述

发布了26 篇原创文章 · 获赞 6 · 访问量 6472

猜你喜欢

转载自blog.csdn.net/weixin_43975128/article/details/88768073