Namespaces
Variants

towupper

From cppreference.net
< c ‎ | string ‎ | wide
定義先ヘッダ <wctype.h>
wint_t towupper ( wint_t wc ) ;
(C95以降)

指定されたワイド文字を可能であれば大文字に変換します。

目次

パラメータ

wc - 変換対象のワイド文字

戻り値

大文字バージョンの wc または、現在のCロケールに大文字バージョンがリストされていない場合は変更されていない wc

注記

この関数で実行できるのは1:1の文字マッピングのみです。例えば、'ß'の大文字形式は(一部の例外を除き)2文字の文字列"SS"となりますが、これは towupper では取得できません。

ISO 30112 は、このマッピングに含まれるUnicode文字のペアを指定します。

#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <locale.h>
int main(void)
{
    wchar_t wc =  L'\u017f'; // Latin small letter Long S ('ſ')
    printf("in the default locale, towupper(%#x) = %#x\n", wc, towupper(wc));
    setlocale(LC_ALL, "en_US.utf8");
    printf("in Unicode locale, towupper(%#x) = %#x\n", wc, towupper(wc));
}

出力:

in the default locale, towupper(0x17f) = 0x17f
in Unicode locale, towupper(0x17f) = 0x53

参考文献

  • C11規格 (ISO/IEC 9899:2011):
  • 7.30.3.1.2 towupper関数 (p: 453)
  • C99規格 (ISO/IEC 9899:1999):
  • 7.25.3.1.2 towupper関数 (p: 399)

関連項目

ワイド文字を小文字に変換
(関数)
文字を大文字に変換
(関数)