次の方法で共有


ctype::toupper

Converts a character or a range of characters to upper case.

CharType toupper(
      CharType _Ch
) const;
const CharType *toupper(
     CharType* _First, 
     const CharType* _Last
) const;

Parameters

  • _Ch
    The character to be converted to uppercase.

  • _First
    A pointer to the first character in the range of characters whose cases are to be converted.

  • _Last
    A pointer to the last character in the range of characters whose cases are to be converted.

Return Value

The first member function returns the uppercase form of the parameter character. If no uppercase form exists, it returns the parameter character.

The second member function returns a constant pointer to the last character in the converted range of characters.

Remarks

The first member function returns do_toupper(_Ch). The second member function returns do_toupper(_First, _Last).

Example

// ctype_toupper.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
using namespace std;

int main( )   
{
   locale loc1 ( "German_Germany" );
   
   char string[] = "Hello, my name is John!";

   use_facet<ctype<char> > ( loc1 ).toupper
      ( &string[0], &string[strlen(&string[0])-1] );
   cout << "The uppercase string is: " << string << endl;
}

The uppercase string is: HELLO, MY NAME IS JOHN!

Requirements

Header: <locale>

Namespace: std

See Also

Concepts

ctype Class

ctype Members