sourCEntral - mobile manpages

pdf

STRCASECMP

名前

strcasecmp, strncasecmp - 二つの文字列を大文字小文字を区別せず比較する

書式

#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) を参照。

img

準拠

4.4BSD, POSIX.1-2001, POSIX.1-2008.

注意

関数 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.

関連項目

bcmp(3), memcmp(3), strcmp(3), strcoll(3), string(3), strncmp(3), wcscasecmp(3), wcsncasecmp(3)

この文書について

この man ページは Linux man-pages プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は https://www.kernel.org/doc/man-pages/ に書かれている。

pdf