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 即到结尾

相关文章:

  • 2022-12-23
  • 2021-11-05
  • 2021-07-16
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-22
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案