string.h头文件中有什么函数

string.h头文件中有什么函数

string.h头文件中的函数:

1、#include <algorithm> //STL 通用算法

2、#include <bitset> //STL 位集容器

3、#include <complex> //复数类

4、#include <deque> //STL双端队列容器

5、#include <exception> //异常处理类

6、#include <list> //STL 线性列表容器

7、#include <map> //STL 映射容器

8、#include <ios> //基本输入/输出支持

9、#include <iosfwd> //输入/输出系统使用的前置声明

10、#include <ios> //基本输入/输出支持

C语言标准库中一个常用的头文件,在使用到字符数组时需要使用。string .h 头文件定义了一个变量类型、一个宏和各种操作字符数组的函数。C语言里面关于字符数组的函数定义的头文件,常用函数有strlen、strcmp、strcpy等等。

扩展资料

一般在C++的库中,对于一个旧的,也就是带“.h”扩展名的库文件(比如iostream.h),在新标准后的标准库中都有一个不带“.h”扩展名的与之相对应,区别除了后者的好多改进之外,还有一点就是后者的东东都塞进了“std”名字空间中。

但唯独string特别。问题在于C++要兼容C的标准库,而C的标准库里碰巧也已经有一个名字叫做“string.h”的头文件,包含一些常用的C字符串处理函数。这个头文件跟C++的string类半点关系也没有,所以 <string>并非 <string.h>的“升级版本”,

参考资料来源:百度百科-string.h

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2017-09-28

string.h头文件里常用的函数有:

    strlen求字符串长度。

    strcmp比较2个字符串是否一样。

    strcat字符串连接操作。

    strcpy字符串拷贝操作。

    strncat字符串连接操作(前n个字符)。

    strncpy字符串拷贝操作(前n个字符)。

    strchr查询字串。

    strstr 查询子串。

string.h是C语言里面关于字符数组的函数定义的头文件,更详细的可以到include文件夹里面查看该文件。

第2个回答  2020-11-19
第3个回答  2012-04-28
http://www.cplusplus.com/reference/clibrary/cstring/
官方解答:
Functions
Copying:
memcpy
Copy block of memory (function)
memmove
Move block of memory (function )
strcpy
Copy string (function)
strncpy
Copy characters from string (function)

Concatenation:
strcat
Concatenate strings (function)
strncat
Append characters from string (function)

Comparison:
memcmp
Compare two blocks of memory (function)
strcmp
Compare two strings (function )
strcoll
Compare two strings using locale (function)
strncmp
Compare characters of two strings (function)
strxfrm
Transform string using locale (function)

Searching:
memchr
Locate character in block of memory (function)
strchr
Locate first occurrence of character in string (function)
strcspn
Get span until character in string (function)
strpbrk
Locate character in string (function)
strrchr
Locate last occurrence of character in string (function)
strspn
Get span of character set in string (function)
strstr
Locate substring (function)
strtok
Split string into tokens (function)

Other:
memset
Fill block of memory (function)
strerror
Get pointer to error message string (function)
strlen
Get string length (function )

Macros
NULL
Null pointer (macro)

Types
size_t
Unsigned integral type (type)
第4个回答  2012-04-28
光标停在string.h上,右键 open documents本回答被提问者采纳
相似回答