標準ライブラリヘッダ <string.h>
From cppreference.com
このヘッダは、ヌル終端バイト文字列を扱うための関数を提供します。
マクロ | ||
| 処理系定義のヌルポインタ定数 (macro constant) | ||
型 | ||
| sizeof 演算子が返す符号無し整数型 (typedef) | ||
関数 | ||
文字列操作 | ||
| (C11) |
ある文字列を別の文字列にコピーする (関数) | |
| (C11) |
ある文字列から別の文字列に指定された文字数をコピーする (関数) | |
| (C11) |
2つの文字列を連結する (関数) | |
| (C11) |
2つの文字列の指定された文字数を連結する (関数) | |
| strcmp が strcoll と同じ結果になるように文字列を変換する (関数) | ||
| (C23) |
文字列のコピーを割り当てる (関数) | |
| (C23) |
指定されたサイズの文字列のコピーを割り当てる (関数) | |
文字列検査 | ||
| (C11) |
与えられた文字列の長さを返す (関数) | |
| 2つの文字列を比較する (関数) | ||
| 2つの文字列の指定された数の文字を比較する (関数) | ||
| 現在のロケールに従って2つの文字列を比較する (関数) | ||
| 最初に出現する文字を見つける (関数) | ||
| 最後に出現する文字を見つける (関数) | ||
| 以下から成る最大の初期セグメントの長さを返す 別のバイト文字列に含まれる文字のみ (関数) | ||
| 以下から成る最大の初期セグメントの長さを返す 別のバイト文字列に含まれない文字のみ (関数) | ||
| ある文字列に含まれる任意の文字が、別の文字列で最初に出現する位置を見つける (関数) | ||
| 部分文字列が最初に出現する箇所を見つける (関数) | ||
| (C11) |
バイト文字列内の次のトークンを見つける (関数) | |
文字配列操作 | ||
| 配列から文字が最初に出現する箇所を検索する (関数) | ||
| 2つのバッファを比較する (関数) | ||
| (C23)(C11) |
バッファを文字で埋める (関数) | |
| (C11) |
あるバッファを別のバッファにコピーする (関数) | |
| (C11) |
あるバッファを別のバッファに移動する (関数) | |
| (C23) |
指定された区切り文字で停止しながら、あるバッファを別のバッファにコピーする (関数) | |
その他 | ||
| (C11)(C11) |
与えられたエラーコードのテキスト版を返す (関数) | |
[編集] 概要
#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