strcasecmp
Section: C Library Functions (3)
Updated: 2026-02-08
Index
JM Home Page
roff page
名前
strcasecmp, strncasecmp - 二つの文字列を大文字小文字を区別せず比較する
ライブラリ
標準 C ライブラリ (libc,~-lc)
書式
#include <strings.h>
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char s1[], const char s2[], size_t n);
説明
The strcasecmp() function performs a byte-by-byte comparison of the
strings s1 and s2, ignoring the case of the characters. It returns an
integer less than, equal to, or greater than zero if s1 is found,
respectively, to be less than, to match, or be greater than s2.
The strncasecmp() function is similar, except that it compares no more
than n bytes of s1 and s2.
返り値
The strcasecmp() and strncasecmp() functions return an integer less
than, equal to, or greater than zero if s1 is, after ignoring case, found
to be less than, to match, or be greater than s2, respectively.
属性
この節で使用されている用語の説明については、 attributes(7) を参照。
| インターフェース | 属性 | 値
|
|
strcasecmp(),
strncasecmp()
| Thread safety | MT-Safe locale
|
標準規格
POSIX.1-2008.
歴史
4.4BSD, POSIX.1-2001.
関数 strcasecmp() と strncasecmp() は 4.4BSD で初めて登場し、 そのときは
<string.h> に宣言があった。 このような、過去との互換性確保のため、 機能検査マクロ
_DEFAULT_SOURCE (glibc 2.19 以前では _BSD_SOURCE) が定義された際に、 glibc
のヘッダーファイル <string.h> でもこれらの関数が宣言されている。
The POSIX.1-2008 standard says of these functions:
-
When the LC_CTYPE category of the locale being used is from the POSIX
locale, these functions shall behave as if the strings had been converted to
lowercase and then a byte comparison performed. Otherwise, the results are
unspecified.
関連項目
memcmp(3), strcmp(3), strcoll(3), string(3), strncmp(3),
wcscasecmp(3), wcsncasecmp(3)
Index
- 名前
-
- ライブラリ
-
- 書式
-
- 説明
-
- 返り値
-
- 属性
-
- 標準規格
-
- 歴史
-
- 関連項目
-
This document was created by
man2html,
using the manual pages.