blob: bf5a8ea2fb99294ea6548c38c1ed38a9842b9bdf [file] [log] [blame]
<HTML>
<HEAD>
<TITLE>toupper()</TITLE>
<LINK REL=StyleSheet HREF="../rw.css" TYPE="text/css" TITLE="Apache stdcxx Stylesheet"></HEAD>
<BODY BGCOLOR=#FFFFFF>
<A HREF="tolower.html"><IMG SRC="images/bprev.gif" WIDTH=20 HEIGHT=21 ALT="Previous file" BORDER=O></A><A HREF="noframes.html"><IMG SRC="images/btop.gif" WIDTH=56 HEIGHT=21 ALT="Top of Document" BORDER=O></A><A HREF="booktoc.html"><IMG SRC="images/btoc.gif" WIDTH=56 HEIGHT=21 ALT="Contents" BORDER=O></A><A HREF="tindex.html"><IMG SRC="images/bindex.gif" WIDTH=56 HEIGHT=21 ALT="Index page" BORDER=O></A><A HREF="transform.html"><IMG SRC="images/bnext.gif" WIDTH=25 HEIGHT=21 ALT="Next file" BORDER=O></A><DIV CLASS="DOCUMENTNAME"><B>Apache C++ Standard Library Reference Guide</B></DIV>
<H2>toupper()</H2>
<P><B>Library:</B>&nbsp;&nbsp;<A HREF="2-6.html">Localization</A></P>
<PRE><HR><B><I>Function</I></B><HR></PRE>
<UL>
<LI><A HREF="#sec1">Local Index</A></LI>
<LI><A HREF="#sec2">Summary</A></LI>
<LI><A HREF="#sec3">Synopsis</A></LI>
<LI><A HREF="#sec4">Description</A></LI>
<LI><A HREF="#sec5">Example</A></LI>
<LI><A HREF="#sec6">See Also</A></LI>
<LI><A HREF="#sec7">Standards Conformance</A></LI>
</UL>
<A NAME="sec1"><H3>Local Index</H3></A>
No Entries
<A NAME="sec2"><H3>Summary</H3></A>
<P>Locale convenience function that converts a character to upper case </P>
<A NAME="sec3"><H3>Synopsis</H3></A>
<PRE>#include &lt;locale&gt;
namespace std {
template &lt;class charT&gt;
charT toupper(charT c, const locale&amp; loc);
}
</PRE>
<A NAME="sec4"><H3>Description</H3></A>
<P>The <SAMP>toupper()</SAMP> function returns the parameter <SAMP>c</SAMP> after converting it to upper case. The conversion is made using the <SAMP>ctype</SAMP> facet from the <SAMP>locale</SAMP> parameter.</P>
<A NAME="sec5"><H3>Example</H3></A>
<UL><PRE>//
// toupper.cpp
//
#include &lt;iomanip&gt; // for setw
#include &lt;iostream&gt; // for cout, endl
int main ()
{
std::cout &lt;&lt; std::oct;
std::cout.fill ('0');
// compute tolower and toupper of printable ASCII characters
for (int c = ' '; c != '~' + 1; ++c)
std::cout &lt;&lt; "std::toupper/lower ('\\" &lt;&lt; std::setw (3)
&lt;&lt; c
&lt;&lt; "', std::locale ()) = '"
&lt;&lt; std::toupper (char (c), std::cout.getloc ())
&lt;&lt; "' / "
&lt;&lt; std::tolower (char (c), std::cout.getloc ())
&lt;&lt; "'\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 ()) = '&amp;' / &amp;'
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 ()) = '&lt;' / &lt;'
std::toupper/lower ('\075', std::locale ()) = '=' / ='
std::toupper/lower ('\076', std::locale ()) = '&gt;' / &gt;'
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 ()) = '~' / ~'
</PRE></UL>
<A NAME="sec6"><H3>See Also</H3></A>
<P><SAMP><A HREF="tolower.html">tolower()</A></SAMP>, <B><I><A HREF="locale.html">locale</A></I></B>, <B><I><A HREF="ctype.html">ctype</A></I></B></P>
<A NAME="sec7"><H3>Standards Conformance</H3></A>
<P><I>ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 22.1.3.2</I></P>
<BR>
<HR>
<A HREF="tolower.html"><IMG SRC="images/bprev.gif" WIDTH=20 HEIGHT=21 ALT="Previous file" BORDER=O></A><A HREF="noframes.html"><IMG SRC="images/btop.gif" WIDTH=56 HEIGHT=21 ALT="Top of Document" BORDER=O></A><A HREF="booktoc.html"><IMG SRC="images/btoc.gif" WIDTH=56 HEIGHT=21 ALT="Contents" BORDER=O></A><A HREF="tindex.html"><IMG SRC="images/bindex.gif" WIDTH=56 HEIGHT=21 ALT="Index page" BORDER=O></A><A HREF="transform.html"><IMG SRC="images/bnext.gif" WIDTH=20 HEIGHT=21 ALT="Next file" BORDER=O></A>
<!-- Google Analytics tracking code -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1775151-1";
urchinTracker();
</script>
<!-- end of Google Analytics tracking code -->
</BODY>
</HTML>