特牛网址导航

c++怎么提取字符串的一部分_c++截取string中的一部分-CSDN博客

网友收藏
文章浏览阅读7w次,点赞37次,收藏120次。C++的string类提供了大量的字符串操作函数,提取字符串的一部分,可采用substr函数实现: 头文件: #include <string> //注意没有.h string.h是C的标准字符串函数数,c++中一般起名为ctring. 而string头文件是C++的字符串头文件。 函数原型: string substr(int pos = 0,int n ..._c++截取string中的一部分