標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
Language Environment | 両方 |
#include <collate.h>
char *colltostr(collel_t c);
照合エレメントのストリングに c を変換します。colltostr() 関数は、strtocoll() とは逆の関数です。
アプリケーション・プログラムは、各エレメントで ismccollel() を 呼び出して、collrange() または collequiv() から戻された配列を 使用できます。ismccollel() がそのエレメントに対して真の場合に だけ、colltostr() を呼び出します。戻されるストリングは、もう一度 setlocale() を呼び出すまで有効です。
単一文字を表す値、または範囲内にない値が渡されると、colltostr() は NULL を戻します。
⁄* CELEBC25
This example prints all the collating elements in the
collating sequence, using the &colltop. function to get the
string for the multi-character collating elements.
*⁄
#include <collate.h>
#include <locale.h>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
main(int argc, char *argv[]) {
collel_t e, *rp;
int i;
setlocale(LC_ALL, "");
i = collorder(&rp);
for (; i-- > 0; rp++) {
if (ismccollel(*rp))
printf("'%s' ", colltostr(*rp));
else if (iswprint(*rp))
printf("'%lc' ", *rp);
else
printf("'%x' ", *rp);
}
}