tolower,_mbctolower,towlower
ctype.h:インデックス への移動
ヘッダーファイル
ctype.h, mbstring.h
カテゴリ
変換ルーチン
プロトタイプ
int tolower(int ch);
int towlower(wint_t ch); // Unicode バージョン
unsigned int _mbctolower(unsigned int c);
説明
文字を小文字に変換します。
tolower は,整数 ch(EOF ~ 255 の範囲)が大文字 A ~ Z の場合に,ch を小文字(a ~ z)に変換する関数です。それ以外の値は変更されません。
戻り値
tolower は,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] = tolower(string[i]);
}
printf("%s\n",string);
return 0;
}
移植性
POSIX | Win32 | ANSI C | ANSI C++ | |
---|---|---|---|---|
tolower |
+ |
+ |
+ |
+ |
_mbctolower |
+ |
|||
towlower |
+ |
+ |
+ |