Standard library header <string.h>
From cppreference.net
此头文件提供用于处理 以空字符结尾的字节字符串 的函数。
宏 |
||
|
实现定义的空指针常量
(宏常量) |
||
类型 |
||
|
sizeof
运算符返回的无符号整数类型
(类型定义) |
||
函数 |
||
字符串操作 |
||
|
(C11)
|
将一个字符串复制到另一个字符串
(函数) |
|
|
(C11)
|
将指定数量的字符从一个字符串复制到另一个字符串
(函数) |
|
|
(C11)
|
连接两个字符串
(函数) |
|
|
(C11)
|
连接两个字符串的指定数量字符
(函数) |
|
|
转换字符串,使 strcmp 产生与 strcoll 相同的结果
(函数) |
||
|
(C23)
|
分配字符串的副本
(函数) |
|
|
(C23)
|
分配指定大小的字符串副本
(函数) |
|
字符串检查 |
||
|
(C11)
|
返回给定字符串的长度
(函数) |
|
|
比较两个字符串
(函数) |
||
|
比较两个字符串的指定数量字符
(函数) |
||
|
根据当前区域设置比较两个字符串
(函数) |
||
|
查找字符的首次出现
(函数) |
||
|
查找字符的最后一次出现
(函数) |
||
|
返回仅包含在另一个字节字符串中找到的字符的
最大初始段的长度 (函数) |
||
|
返回不包含在另一个字节字符串中找到的字符的
最大初始段的长度 (函数) |
||
|
在一个字符串中查找另一个字符串中任何字符的首次出现位置
(函数) |
||
|
<a href="../string/byte/strstr.html" title="c/string/
|
||
概要
#define __STDC_VERSION_STRING_H__ 202311L #define NULL /* 参见描述 */ typedef /* 参见描述 */ size_t; void* memcpy(void* restrict s1, const void* restrict s2, size_t n); void* memccpy(void* restrict s1, const void* restrict s2, int c, size_t n); void* memmove(void* s1, const void* s2, size_t n); char* strcpy(char* restrict s1, const char* restrict s2); char* strncpy(char* restrict s1, const char* restrict s2, size_t n); char* strdup(const char* s); char* strndup(const char* s, size_t n); char* strcat(char* restrict s1, const char* restrict s2); char* strncat(char* restrict s1, const char* restrict s2, size_t n); int memcmp(const void* s1, const void* s2, size_t n); int strcmp(const char* s1, const char* s2); int strcoll(const char* s1, const char* s2); int strncmp(const char* s1, const char* s2, size_t n); size_t strxfrm(char* restrict s1, const char* restrict s2, size_t n); /*QVoid*/* memchr(/*QVoid*/* s, int c, size_t n); /*QChar*/* strchr(/*QChar*/* s, int c); size_t strcspn(const char* s1, const char* s2); /*QChar*/* strpbrk(/*QChar*/* s1, const char* s2); /*QChar*/* strrchr(/*QChar*/* s, int c); size_t strspn(const char* s1, const char* s2); /*QChar*/* strstr(/*QChar*/* s1, const char* s2); char* strtok(char* restrict s1, const char* restrict s2); void* memset(void* s, int c, size_t n); void* memset_explicit(void* s, int c, size_t n); char* strerror(int errnum); size_t strlen(const char* s); size_t strnlen(const char* s, size_t n);
仅当实现定义了
__STDC_LIB_EXT1__
且用户代码在包含
<string.h>
之前额外定义了
__STDC_WANT_LIB_EXT1__
时:
#ifdef __STDC_WANT_LIB_EXT1__ tyepdef /* 详见描述 */ errno_t; tyepdef /* 详见描述 */ rsize_t; errno_t memcpy_s(void* restrict s1, rsize_t s1max, const void* restrict s2, rsize_t n); errno_t memmove_s(void* s1, rsize_t s1max, const void* s2, rsize_t n); errno_t strcpy_s(char* restrict s1, rsize_t s1max, const char* restrict s2); errno_t strncpy_s(char* restrict s1, rsize_t s1max, const char* restrict s2, rsize_t n); errno_t strcat_s(char* restrict s1, rsize_t s1max, const char* restrict s2); errno_t strncat_s(char* restrict s1, rsize_t s1max, const char* restrict s2, rsize_t n); char* strtok_s(char* restrict s1, rsize_t* restrict s1max, const char* restrict s2, char** restrict ptr); errno_t memset_s(void* s, rsize_t smax, int c, rsize_t n) errno_t strerror_s(char* s, rsize_t maxsize, errno_t errnum); size_t strerrorlen_s(errno_t errnum); size_t strnlen_s(const char* s, size_t maxsize); #endif