toupper,_mbctoupper,towupper

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

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


ヘッダーファイル

ctype.h, mbstring.h

カテゴリ

変換ルーチン

プロトタイプ

int toupper(int ch);

int towupper(wint_t ch); // Unicode バージョン

unsigned int _mbctoupper(unsigned int c);

説明

文字を大文字に変換します。

toupper は,整数 ch(EOF ~ 255 の範囲)が小文字 a ~ z の場合に,ch を大文字(A ~ Z)に変換する関数です。それ以外の値は変更されません。

towupper は toupper の Unicode バージョンです。Unicode が定義されている場合に使用できます。

戻り値

toupper は,ch が小文字の場合,ch を変換した値を返します。それ以外の文字はそのまま返します。



 #include <string.h>
 #include <stdio.h>
 #include <ctype.h>
 int main(void)
 {
    int length, i;
    char *string = "this is a string";
    length = strlen(string);
    for (i=0; i<length; i++)
    {
       string[i] = toupper(string[i]);
    }
    printf("%s\n",string);
    return 0;
 }



移植性



POSIX Win32 ANSI C ANSI C++

toupper

+

+

+

+

_mbctoupper

+

towupper

+

+

+