Library: Localization
Function
Locale convenience function that converts a character to upper case
#include <locale>
namespace std {
template <class charT>
charT toupper(charT c, const locale& loc);
}
The toupper() function returns the parameter c after converting it to upper case. The conversion is made using the ctype facet from the locale parameter.
//
// toupper.cpp
//
#include <iomanip> // for setw
#include <iostream> // for cout, endl
int main ()
{
std::cout << std::oct;
std::cout.fill ('0');
// compute tolower and toupper of printable ASCII characters
for (int c = ' '; c != '~' + 1; ++c)
std::cout << "std::toupper/lower ('\\" << std::setw (3)
<< c
<< "', std::locale ()) = '"
<< std::toupper (char (c), std::cout.getloc ())
<< "' / "
<< std::tolower (char (c), std::cout.getloc ())
<< "'\n";
return 0;
}
Program Output:
std::toupper/lower ('040円', std::locale ()) = ' ' / '
std::toupper/lower ('041円', std::locale ()) = '!' / !'
std::toupper/lower ('042円', std::locale ()) = '"' / "'
std::toupper/lower ('043円', std::locale ()) = '#' / #'
std::toupper/lower ('044円', std::locale ()) = '$' / $'
std::toupper/lower ('045円', std::locale ()) = '%' / %'
std::toupper/lower ('046円', std::locale ()) = '&' / &'
std::toupper/lower ('047円', std::locale ()) = ''' / ''
std::toupper/lower ('050円', std::locale ()) = '(' / ('
std::toupper/lower ('051円', std::locale ()) = ')' / )'
std::toupper/lower ('052円', std::locale ()) = '*' / *'
std::toupper/lower ('053円', std::locale ()) = '+' / +'
std::toupper/lower ('054円', std::locale ()) = ',' / ,'
std::toupper/lower ('055円', std::locale ()) = '-' / -'
std::toupper/lower ('056円', std::locale ()) = '.' / .'
std::toupper/lower ('057円', std::locale ()) = '/' / /'
std::toupper/lower ('060円', std::locale ()) = '0' / 0'
std::toupper/lower ('061円', std::locale ()) = '1' / 1'
std::toupper/lower ('062円', std::locale ()) = '2' / 2'
std::toupper/lower ('063円', std::locale ()) = '3' / 3'
std::toupper/lower ('064円', std::locale ()) = '4' / 4'
std::toupper/lower ('065円', std::locale ()) = '5' / 5'
std::toupper/lower ('066円', std::locale ()) = '6' / 6'
std::toupper/lower ('067円', std::locale ()) = '7' / 7'
std::toupper/lower ('070円', std::locale ()) = '8' / 8'
std::toupper/lower ('071円', std::locale ()) = '9' / 9'
std::toupper/lower ('072円', std::locale ()) = ':' / :'
std::toupper/lower ('073円', std::locale ()) = ';' / ;'
std::toupper/lower ('074円', std::locale ()) = '<' / <'
std::toupper/lower ('075円', std::locale ()) = '=' / ='
std::toupper/lower ('076円', std::locale ()) = '>' / >'
std::toupper/lower ('077円', std::locale ()) = '?' / ?'
std::toupper/lower ('100円', std::locale ()) = '@' / @'
std::toupper/lower ('101円', std::locale ()) = 'A' / a'
std::toupper/lower ('102円', std::locale ()) = 'B' / b'
std::toupper/lower ('103円', std::locale ()) = 'C' / c'
std::toupper/lower ('104円', std::locale ()) = 'D' / d'
std::toupper/lower ('105円', std::locale ()) = 'E' / e'
std::toupper/lower ('106円', std::locale ()) = 'F' / f'
std::toupper/lower ('107円', std::locale ()) = 'G' / g'
std::toupper/lower ('110円', std::locale ()) = 'H' / h'
std::toupper/lower ('111円', std::locale ()) = 'I' / i'
std::toupper/lower ('112円', std::locale ()) = 'J' / j'
std::toupper/lower ('113円', std::locale ()) = 'K' / k'
std::toupper/lower ('114円', std::locale ()) = 'L' / l'
std::toupper/lower ('115円', std::locale ()) = 'M' / m'
std::toupper/lower ('116円', std::locale ()) = 'N' / n'
std::toupper/lower ('117円', std::locale ()) = 'O' / o'
std::toupper/lower ('120円', std::locale ()) = 'P' / p'
std::toupper/lower ('121円', std::locale ()) = 'Q' / q'
std::toupper/lower ('122円', std::locale ()) = 'R' / r'
std::toupper/lower ('123円', std::locale ()) = 'S' / s'
std::toupper/lower ('124円', std::locale ()) = 'T' / t'
std::toupper/lower ('125円', std::locale ()) = 'U' / u'
std::toupper/lower ('126円', std::locale ()) = 'V' / v'
std::toupper/lower ('127円', std::locale ()) = 'W' / w'
std::toupper/lower ('130円', std::locale ()) = 'X' / x'
std::toupper/lower ('131円', std::locale ()) = 'Y' / y'
std::toupper/lower ('132円', std::locale ()) = 'Z' / z'
std::toupper/lower ('133円', std::locale ()) = '[' / ['
std::toupper/lower ('134円', std::locale ()) = '\' / \'
std::toupper/lower ('135円', std::locale ()) = ']' / ]'
std::toupper/lower ('136円', std::locale ()) = '^' / ^'
std::toupper/lower ('137円', std::locale ()) = '_' / _'
std::toupper/lower ('140円', std::locale ()) = '`' / `'
std::toupper/lower ('141円', std::locale ()) = 'A' / a'
std::toupper/lower ('142円', std::locale ()) = 'B' / b'
std::toupper/lower ('143円', std::locale ()) = 'C' / c'
std::toupper/lower ('144円', std::locale ()) = 'D' / d'
std::toupper/lower ('145円', std::locale ()) = 'E' / e'
std::toupper/lower ('146円', std::locale ()) = 'F' / f'
std::toupper/lower ('147円', std::locale ()) = 'G' / g'
std::toupper/lower ('150円', std::locale ()) = 'H' / h'
std::toupper/lower ('151円', std::locale ()) = 'I' / i'
std::toupper/lower ('152円', std::locale ()) = 'J' / j'
std::toupper/lower ('153円', std::locale ()) = 'K' / k'
std::toupper/lower ('154円', std::locale ()) = 'L' / l'
std::toupper/lower ('155円', std::locale ()) = 'M' / m'
std::toupper/lower ('156円', std::locale ()) = 'N' / n'
std::toupper/lower ('157円', std::locale ()) = 'O' / o'
std::toupper/lower ('160円', std::locale ()) = 'P' / p'
std::toupper/lower ('161円', std::locale ()) = 'Q' / q'
std::toupper/lower ('162円', std::locale ()) = 'R' / r'
std::toupper/lower ('163円', std::locale ()) = 'S' / s'
std::toupper/lower ('164円', std::locale ()) = 'T' / t'
std::toupper/lower ('165円', std::locale ()) = 'U' / u'
std::toupper/lower ('166円', std::locale ()) = 'V' / v'
std::toupper/lower ('167円', std::locale ()) = 'W' / w'
std::toupper/lower ('170円', std::locale ()) = 'X' / x'
std::toupper/lower ('171円', std::locale ()) = 'Y' / y'
std::toupper/lower ('172円', std::locale ()) = 'Z' / z'
std::toupper/lower ('173円', std::locale ()) = '{' / {'
std::toupper/lower ('174円', std::locale ()) = '|' / |'
std::toupper/lower ('175円', std::locale ()) = '}' / }'
std::toupper/lower ('176円', std::locale ()) = '~' / ~'
ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 22.1.3.2