标准库标头 <cstring>

来自cppreference.com
< cpp‎ | header
 
 
标准库标头
注:修订记号中的反斜杠 '/' 意味着此标头被弃用和/或被移除。
语言支持
概念
<concepts> (C++20)
诊断
<system_error> (C++11)
内存管理
<memory_resource> (C++17)  
元编程
<type_traits> (C++11)
<ratio> (C++11)
通用工具
<utility>
<tuple> (C++11)
<optional> (C++17)
<variant> (C++17)
<any> (C++17)
<expected> (C++23)
<bitset>

<charconv> (C++17)
<format> (C++20)
<bit> (C++20)

字符串
<cstring>
<cwchar>
<cuchar> (C++11)

容器
<flat_set> (C++23)
<span> (C++20)
<mdspan> (C++23)

迭代器
<iterator>
范围
<ranges> (C++20)
<generator> (C++23)
算法
数值
<cfenv> (C++11)
<complex>
<numbers> (C++20)

日期时间
<chrono> (C++11)
本地化
<codecvt> (C++11/17)
输入/输出
<filesystem> (C++17)
<cstdio>
<cinttypes> (C++11)
<strstream> (C++98/)
正则表达式
<regex>
并发支持
<stop_token> (C++20)
<thread> (C++11)
<atomic> (C++11)
<stdatomic.h> (C++23)
<mutex> (C++11)
<shared_mutex> (C++14)
<condition_variable> (C++11)  
<semaphore> (C++20)
<latch> (C++20)
<barrier> (C++20)
<future> (C++11)

C 兼容
<cstdbool> (C++11/17/20)  
<ccomplex> (C++11/17/20)
<ctgmath> (C++11/17/20)

<cstdalign> (C++11/17/20)

<ciso646> (C++20 前)

 

此标头原作为 <string.h> 存在于 C 标准库。

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

目录

[编辑]

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

[编辑] 类型

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

[编辑] 函数

字符串操纵
复制一个字符串给另一个
(函数) [编辑]
复制来自一个字符串的一定量字符给另一个
(函数) [编辑]
连接两个字符串
(函数) [编辑]
连接两个字符串的一定量字符
(函数) [编辑]
变换字符串,使得 strcmp 会返回与 strcoll 相同的结果
(函数) [编辑]
字符串检验
返回给定字符串的长度
(函数) [编辑]
比较两个字符串
(函数) [编辑]
比较两个字符串的一定量字符
(函数) [编辑]
按照当前本地环境比较两个字符串
(函数) [编辑]
寻找字符的首次出现
(函数) [编辑]
寻找字符的最后出现
(函数) [编辑]
返回仅由另一字节字符串中找到的字符组成的最大起始段的长度
(函数) [编辑]
返回仅由另一字节字符串中找不到的字符组成的最大起始段的长度
(函数) [编辑]
寻找任何来自分隔符集合的字符的首个位置
(函数) [编辑]
寻找字符子串的首次出现
(函数) [编辑]
寻找字节字符串中的下个记号
(函数) [编辑]
字符数组操纵
在数组中搜索字符的首次出现
(函数) [编辑]
比较两个缓冲区
(函数) [编辑]
以一个字符填充缓冲区
(函数) [编辑]
复制一个缓冲区到另一个
(函数) [编辑]
移动一个缓冲区到另一个
(函数) [编辑]
杂项
返回给定错误码的文本版本
(函数) [编辑]

[编辑] 注意

[编辑] 概要

namespace std {
  using size_t = /* 见描述 */;                           // 独立
 
  void* memcpy(void* s1, const void* s2, size_t n);      // 独立
  void* memmove(void* s1, const void* s2, size_t n);     // 独立
  char* strcpy(char* s1, const char* s2);                // 独立
  char* strncpy(char* s1, const char* s2, size_t n);     // 独立
  char* strcat(char* s1, const char* s2);                // 独立
  char* strncat(char* s1, const char* 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* s1, const char* s2, size_t n);
  const void* memchr(const void* s, int c, size_t n);    // 独立
  void* memchr(void* s, int c, size_t n);                // 独立
  const char* strchr(const char* s, int c);              // 独立
  char* strchr(char* s, int c);                          // 独立
  size_t strcspn(const char* s1, const char* s2);        // 独立
  const char* strpbrk(const char* s1, const char* s2);   // 独立
  char* strpbrk(char* s1, const char* s2);               // 独立
  const char* strrchr(const char* s, int c);             // 独立
  char* strrchr(char* s, int c);                         // 独立
  size_t strspn(const char* s1, const char* s2);         // 独立
  const char* strstr(const char* s1, const char* s2);    // 独立
  char* strstr(char* s1, const char* s2);                // 独立
  char* strtok(char* s1, const char* s2);                // 独立
  void* memset(void* s, int c, size_t n);                // 独立
  char* strerror(int errnum);
  size_t strlen(const char* s);                          // 独立
}
 
#define NULL /* 见描述 */                                // 独立