strcoll,_stricoll,_mbscoll,_mbsicoll,wcscoll,_wcsicoll

提供: RAD Studio
移動先: 案内検索

string.h:インデックス への移動


ヘッダーファイル

string.h, mbstring.h

カテゴリ

メモリと文字列の操作ルーチン

プロトタイプ

int strcoll(const char *s1, const char *s2);

int wcscoll(const wchar_t *s1, const wchar_t *s2);

int _stricoll(const char *s1, const char *s2);

int _wcsicoll(const wchar_t *s1, wconst_t char *s2);

int _mbscoll(const unsigned char *s1, const unsigned char *s2);

int _mbsicoll(const unsigned char *s1, const unsigned char *s2);

説明

2 つの文字列を比較します。

strcoll は,現在のロケールの LC_COLLATE カテゴリにしたがって,s1 が指す文字列と s2 が指す文字列を比較します。

_stricoll は strcoll と同様の動作を行いますが,大文字と小文字は区別されません。

メモ:  メモ

_stricoll は,現在のロケールの LC_COLLATE カテゴリにしたがっては文字列を比較しません。_stricoll は stricmp を提供します。要求された照合は,_lstricoll を呼び出すか,単に stricoll(_lstricoll にマップされる)を呼び出して行われます。

実際の照合(_lstricoll)では -1,0 または 1 が返されますが,_stricoll はコードポイントの比較を実行し,< 0,0,または > 0 を返します。

戻り値

s2 より小さい

< 0

s2 と同じ

== 0

s2 より大きい

> 0





 #include <stdio.h>
 #include <string.h>
 int main(void)
 {
    char *two = "International";
    char *one = "Borland";
    int check;
    check = strcoll(one, two);
    if (check == 0)
       printf("The strings are equal\n");
    if (check <  0)
       printf("%s comes before %s\n", one, two);
    if (check >  0)
       printf("%s comes before %s\n", two, one);
    return 0;
 }



移植性



POSIX Win32 ANSI C ANSI C++

strcoll

+

+

+

+

_stricoll

+

_mbscoll

+

_mbsicoll

+

wcscoll

+

+

+

_wcsicoll

+