名稱空間
變體
操作

標準庫標頭檔案 <string.h>

來自 cppreference.com

此標頭檔案提供處理空終止位元組字串的函式。

目錄

實現定義的空指標常量
(宏常量) [編輯]

型別

sizeof 運算子返回的無符號整型
(typedef) [編輯]

函式

字串操作
將一個字串複製到另一個字串
(函式) [編輯]
從一個字串複製一定數量的字元到另一個字串
(函式) [編輯]
連線兩個字串
(函式) [編輯]
連線兩個字串的特定數量的字元
(函式) [編輯]
轉換字串,使 strcmp 產生與 strcoll 相同的結果
(函式) [編輯]
(C23)
分配一個字串的副本
(函式) [編輯]
分配一個指定大小的字串副本
(函式) [編輯]
字串檢查
返回給定字串的長度
(函式) [編輯]
比較兩個字串
(函式) [編輯]
比較兩個字串的特定數量的字元
(函式) [編輯]
根據當前區域設定比較兩個字串
(函式) [編輯]
查詢字元的第一次出現
(函式) [編輯]
查詢字元的最後一次出現
(函式) [編輯]
返回由另一個位元組字串中找到的字元組成的最大初始段的長度
的字元
(函式) [編輯]
返回由另一個位元組字串中找到的字元組成的最大初始段的長度
僅由另一個位元組字串中未找到的字元組成
(函式) [編輯]
在一個字串中查詢另一個字串中任意字元的第一個位置
(函式) [編輯]
查詢字元子字串的第一次出現
(函式) [編輯]
查詢位元組字串中的下一個標記
(函式) [編輯]
字元陣列操作
在陣列中搜索字元的第一次出現
(函式) [編輯]
比較兩個緩衝區
(函式) [編輯]
用字元填充緩衝區
(函式) [編輯]
將一個緩衝區複製到另一個緩衝區
(函式) [編輯]
將一個緩衝區移動到另一個緩衝區
(函式) [編輯]
將一個緩衝區複製到另一個緩衝區,在指定的分隔符處停止
(函式) [編輯]
雜項
返回給定錯誤程式碼的文字版本
(函式) [編輯]

[編輯] 概要

#define __STDC_VERSION_STRING_H__ 202311L
 
#define NULL /* see description */
 
typedef /* see description */ 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 /* see description */ errno_t;
tyepdef /* see description */ 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