Standard library header <string.h>
From cppreference.net
此头文件提供用于处理 null-terminated byte strings 的函数。
宏定义 |
||
|
实现定义的空指针常量
(宏常量) |
||
类型 |
||
|
由
sizeof
运算符返回的无符号整数类型
(类型定义) |
||
函数 |
||
字符串操作 |
||
|
(C11)
|
将一个字符串复制到另一个字符串
(函数) |
|
|
(C11)
|
将指定数量的字符从一个字符串复制到另一个字符串
(函数) |
|
|
(C11)
|
连接两个字符串
(函数) |
|
|
(C11)
|
连接两个字符串的指定数量字符
(函数) |
|
|
转换字符串使得 strcmp 能产生与 strcoll 相同的结果
(函数) |
||
|
(C23)
|
分配字符串的副本
(函数) |
|
|
(C23)
|
分配指定大小的字符串副本
(函数) |
|
字符串检查 |
||
|
(C11)
|
返回给定字符串的长度
(函数) |
|
|
比较两个字符串
(函数) |
||
|
比较两个字符串的指定数量字符
(函数) |
||
|
根据当前区域设置比较两个字符串
(函数) |
||
|
查找字符的首次出现
(函数) |
||
|
查找字符的最后一次出现
(函数) |
||
|
返回仅包含另一字节字符串中字符的
最大起始段的长度 (函数) |
||
|
返回仅包含不在另一个字节字符串中出现的字符的
最大起始段的长度 (函数) |
||
|
在一个字符串中查找另一个字符串中任意字符的首次出现位置
(函数) |
||
|
查找字符子串的首次出现位置
(函数) |
||
|
(C11)
|
在字节字符串中查找下一个令牌
(函数) |
|
字符数组操作 |
||
|
在数组中搜索字符的首次出现
(函数) |
||
|
比较两个缓冲区
(函数) |
||
|
(C23)
(C11)
|
使用字符填充缓冲区
(函数) |
|
|
(C11)
|
将一个缓冲区复制到另一个缓冲区
(函数) |
|
|
(C11)
|
移动一个缓冲区到另一个缓冲区
(函数) |
|
|
(C23)
|
将一个缓冲区复制到另一个缓冲区,在遇到指定分隔符后停止
(函数) |
|
杂项 |
||
|
(C11)
(C11)
|
返回给定错误码的文本描述
(函数) |
|
概述
#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