toupper
將字元轉換為大寫。
template<Class CharType>
CharType toupper(
CharType _Ch,
const locale& _Loc
)
參數
_Ch
要轉換為大寫的字元。_Loc
包含的地區設定要轉換的。
傳回值
字元轉換成大寫。
備註
樣板函式傳回 use_facet<ctype<CharType> > (_Loc)。toupper(_Ch)。
範例
// locale_toupper.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
using namespace std;
int main( )
{
locale loc ( "German_Germany" );
char result1 = toupper ( 'h', loc );
cout << "The upper case of 'h' in the locale is: "
<< result1 << "." << endl;
char result2 = toupper ( 'H', loc );
cout << "The upper case of 'H' in the locale is: "
<< result2 << "." << endl;
char result3 = toupper ( '$', loc );
cout << "The upper case of '$' in the locale is: "
<< result3 << "." << endl;
}
Output
The upper case of 'h' in the locale is: H.
The upper case of 'H' in the locale is: H.
The upper case of '$' in the locale is: $.
需求
標題: <locale>
命名空間: std