| <html lang="en"> |
| <head> |
| <title>Case Conversion - The GNU C Library</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="The GNU C Library"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="Character-Handling.html#Character-Handling" title="Character Handling"> |
| <link rel="prev" href="Classification-of-Characters.html#Classification-of-Characters" title="Classification of Characters"> |
| <link rel="next" href="Classification-of-Wide-Characters.html#Classification-of-Wide-Characters" title="Classification of Wide Characters"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| This file documents the GNU C library. |
| |
| This is Edition 0.12, last updated 2007-10-27, |
| of `The GNU C Library Reference Manual', for version |
| 2.8 (Sourcery G++ Lite 2011.03-41). |
| |
| Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, |
| 2003, 2007, 2008, 2010 Free Software Foundation, Inc. |
| |
| Permission is granted to copy, distribute and/or modify this document |
| under the terms of the GNU Free Documentation License, Version 1.3 or |
| any later version published by the Free Software Foundation; with the |
| Invariant Sections being ``Free Software Needs Free Documentation'' |
| and ``GNU Lesser General Public License'', the Front-Cover texts being |
| ``A GNU Manual'', and with the Back-Cover Texts as in (a) below. A |
| copy of the license is included in the section entitled "GNU Free |
| Documentation License". |
| |
| (a) The FSF's Back-Cover Text is: ``You have the freedom to |
| copy and modify this GNU manual. Buying copies from the FSF |
| supports it in developing GNU and promoting software freedom.''--> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| <link rel="stylesheet" type="text/css" href="../cs.css"> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="Case-Conversion"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="Classification-of-Wide-Characters.html#Classification-of-Wide-Characters">Classification of Wide Characters</a>, |
| Previous: <a rel="previous" accesskey="p" href="Classification-of-Characters.html#Classification-of-Characters">Classification of Characters</a>, |
| Up: <a rel="up" accesskey="u" href="Character-Handling.html#Character-Handling">Character Handling</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">4.2 Case Conversion</h3> |
| |
| <p><a name="index-character-case-conversion-396"></a><a name="index-case-conversion-of-characters-397"></a><a name="index-converting-case-of-characters-398"></a> |
| This section explains the library functions for performing conversions |
| such as case mappings on characters. For example, <code>toupper</code> |
| converts any character to upper case if possible. If the character |
| can't be converted, <code>toupper</code> returns it unchanged. |
| |
| <p>These functions take one argument of type <code>int</code>, which is the |
| character to convert, and return the converted character as an |
| <code>int</code>. If the conversion is not applicable to the argument given, |
| the argument is returned unchanged. |
| |
| <p><strong>Compatibility Note:</strong> In pre-ISO C<!-- /@w --> dialects, instead of |
| returning the argument unchanged, these functions may fail when the |
| argument is not suitable for the conversion. Thus for portability, you |
| may need to write <code>islower(c) ? toupper(c) : c</code> rather than just |
| <code>toupper(c)</code>. |
| |
| <p>These functions are declared in the header file <samp><span class="file">ctype.h</span></samp>. |
| <a name="index-ctype_002eh-399"></a> |
| <!-- ctype.h --> |
| <!-- ISO --> |
| |
| <div class="defun"> |
| — Function: int <b>tolower</b> (<var>int c</var>)<var><a name="index-tolower-400"></a></var><br> |
| <blockquote><p>If <var>c</var> is an upper-case letter, <code>tolower</code> returns the corresponding |
| lower-case letter. If <var>c</var> is not an upper-case letter, |
| <var>c</var> is returned unchanged. |
| </p></blockquote></div> |
| |
| <!-- ctype.h --> |
| <!-- ISO --> |
| <div class="defun"> |
| — Function: int <b>toupper</b> (<var>int c</var>)<var><a name="index-toupper-401"></a></var><br> |
| <blockquote><p>If <var>c</var> is a lower-case letter, <code>toupper</code> returns the corresponding |
| upper-case letter. Otherwise <var>c</var> is returned unchanged. |
| </p></blockquote></div> |
| |
| <!-- ctype.h --> |
| <!-- SVID, BSD --> |
| <div class="defun"> |
| — Function: int <b>toascii</b> (<var>int c</var>)<var><a name="index-toascii-402"></a></var><br> |
| <blockquote><p>This function converts <var>c</var> to a 7-bit <code>unsigned char</code> value |
| that fits into the US/UK ASCII character set, by clearing the high-order |
| bits. This function is a BSD extension and is also an SVID extension. |
| </p></blockquote></div> |
| |
| <!-- ctype.h --> |
| <!-- SVID --> |
| <div class="defun"> |
| — Function: int <b>_tolower</b> (<var>int c</var>)<var><a name="index-g_t_005ftolower-403"></a></var><br> |
| <blockquote><p>This is identical to <code>tolower</code>, and is provided for compatibility |
| with the SVID. See <a href="SVID.html#SVID">SVID</a>. |
| </p></blockquote></div> |
| |
| <!-- ctype.h --> |
| <!-- SVID --> |
| <div class="defun"> |
| — Function: int <b>_toupper</b> (<var>int c</var>)<var><a name="index-g_t_005ftoupper-404"></a></var><br> |
| <blockquote><p>This is identical to <code>toupper</code>, and is provided for compatibility |
| with the SVID. |
| </p></blockquote></div> |
| |
| </body></html> |
| |