C++中字符串与字符串函数的使用

引用字符串或者使用字符串函数

注意,在C++中,#include<string>#include<ctring>#include<string.h>是不一样的。

  • 使用C中的字符串函数比如strlen(),需要引入的是#include<ctring>或者#include<string.h>

  • 使用字符串变量比如string str = "abc",需要引入的是#include<string>

posted @ 2020-07-22 15:27  程序员曾奈斯  阅读(470)  评论(0编辑  收藏  举报