命名空间
变体
操作

标准库头文件 <cstring>

来自 cppreference.cn
< cpp‎ | header
 
 
标准库头文件
算法
<algorithm>
<numeric>
字符串
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
文本处理
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
数值
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<valarray>
时间
<chrono> (C++11)
<ctime>
C 兼容性
<ccomplex> (C++11/17/20*)
<ciso646> (直到 C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

此头文件最初在 C 标准库中为 <string.h>

此头文件用于 C 风格的空终止字节字符串

目录

实现定义的空指针常量
(宏常量) [编辑]

类型

sizeof 运算符返回的无符号整数类型
(类型定义) [编辑]

函数

字符串操作
将一个字符串复制到另一个字符串
(函数) [编辑]
将一定数量的字符从一个字符串复制到另一个字符串
(函数) [编辑]
连接两个字符串
(函数) [编辑]
连接两个字符串的一定数量的字符
(函数) [编辑]
转换字符串,使 strcmp 产生与 strcoll 相同的结果
(函数) [编辑]
字符串检查
返回给定字符串的长度
(函数) [编辑]
比较两个字符串
(函数) [编辑]
比较两个字符串中一定数量的字符
(函数) [编辑]
根据当前区域设置比较两个字符串
(函数) [编辑]
查找字符的首次出现
(函数) [编辑]
查找字符的最后一次出现
(函数) [编辑]
返回最大初始段的长度,该段仅包含
在另一个字节字符串中找到的字符
(函数) [编辑]
返回最大初始段的长度,该段仅包含
仅包含在另一个字节字符串中未找到的字符
(函数) [编辑]
查找分隔符集中任何字符的第一个位置
(函数) [编辑]
查找字符子字符串的首次出现
(函数) [编辑]
在字节字符串中查找下一个标记
(函数) [编辑]
字符数组操作
在数组中搜索字符的首次出现
(函数) [编辑]
比较两个缓冲区
(函数) [编辑]
用字符填充缓冲区
(函数) [编辑]
将一个缓冲区复制到另一个缓冲区
(函数) [编辑]
将一个缓冲区移动到另一个缓冲区
(函数) [编辑]
杂项
返回给定错误代码的文本版本
(函数) [编辑]

[编辑] 注释

[编辑] 概要

namespace std {
  using size_t = /* see description */;                  // freestanding
 
  void* memcpy(void* s1, const void* s2, size_t n);      // freestanding
  void* memmove(void* s1, const void* s2, size_t n);     // freestanding
  char* strcpy(char* s1, const char* s2);                // freestanding
  char* strncpy(char* s1, const char* s2, size_t n);     // freestanding
  char* strcat(char* s1, const char* s2);                // freestanding
  char* strncat(char* s1, const char* s2, size_t n);     // freestanding
  int memcmp(const void* s1, const void* s2, size_t n);  // freestanding
  int strcmp(const char* s1, const char* s2);            // freestanding
  int strcoll(const char* s1, const char* s2);
  int strncmp(const char* s1, const char* s2, size_t n); // freestanding
  size_t strxfrm(char* s1, const char* s2, size_t n);
  const void* memchr(const void* s, int c, size_t n);    // freestanding
  void* memchr(void* s, int c, size_t n);                // freestanding
  const char* strchr(const char* s, int c);              // freestanding
  char* strchr(char* s, int c);                          // freestanding
  size_t strcspn(const char* s1, const char* s2);        // freestanding
  const char* strpbrk(const char* s1, const char* s2);   // freestanding
  char* strpbrk(char* s1, const char* s2);               // freestanding
  const char* strrchr(const char* s, int c);             // freestanding
  char* strrchr(char* s, int c);                         // freestanding
  size_t strspn(const char* s1, const char* s2);         // freestanding
  const char* strstr(const char* s1, const char* s2);    // freestanding
  char* strstr(char* s1, const char* s2);                // freestanding
  char* strtok(char* s1, const char* s2);                // freestanding
  void* memset(void* s, int c, size_t n);                // freestanding
  char* strerror(int errnum);
  size_t strlen(const char* s);                          // freestanding
}
 
#define NULL /* see description */                       // freestanding