diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/c/string%2Fbyte%2Ftolower.html | |
new repository
Diffstat (limited to 'devdocs/c/string%2Fbyte%2Ftolower.html')
| -rw-r--r-- | devdocs/c/string%2Fbyte%2Ftolower.html | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/devdocs/c/string%2Fbyte%2Ftolower.html b/devdocs/c/string%2Fbyte%2Ftolower.html new file mode 100644 index 00000000..5e9a1f90 --- /dev/null +++ b/devdocs/c/string%2Fbyte%2Ftolower.html @@ -0,0 +1,49 @@ + <h1 id="firstHeading" class="firstHeading">tolower</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code><ctype.h></code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl"> <td class="t-dcl-nopad"> <pre data-language="c">int tolower( int ch );</pre> +</td> <td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> </table> <p>Converts the given character to lowercase according to the character conversion rules defined by the currently installed C locale.</p> +<p>In the default "C" locale, the following uppercase letters <code>ABCDEFGHIJKLMNOPQRSTUVWXYZ</code> are replaced with respective lowercase letters <code>abcdefghijklmnopqrstuvwxyz</code>.</p> +<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> ch </td> <td> - </td> <td> character to be converted. If the value of <code>ch</code> is not representable as <code>unsigned char</code> and does not equal <code><a href="http://en.cppreference.com/w/c/io"><span class="kw888">EOF</span></a></code>, the behavior is undefined. </td> +</tr> +</table> <h3 id="Return_value"> Return value</h3> <p>Lowercase version of <code>ch</code> or unmodified <code>ch</code> if no lowercase version is listed in the current C locale.</p> +<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <stdio.h> +#include <ctype.h> +#include <locale.h> +#include <limits.h> + +int main(void) +{ + /* In the default locale: */ + for (unsigned char u = 0; u < UCHAR_MAX; u++) { + unsigned char l = tolower(u); + if (l != u) printf("%c%c ", u, l); + } + printf("\n\n"); + + unsigned char c = '\xb4'; // the character Ž in ISO-8859-15 + // but ´ (acute accent) in ISO-8859-1 + setlocale(LC_ALL, "en_US.iso88591"); + printf("in iso8859-1, tolower('0x%x') gives 0x%x\n", c, tolower(c)); + setlocale(LC_ALL, "en_US.iso885915"); + printf("in iso8859-15, tolower('0x%x') gives 0x%x\n", c, tolower(c)); +}</pre></div> <p>Possible output:</p> +<div class="text source-text"><pre data-language="c">Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz + +in iso8859-1, tolower('0xb4') gives 0xb4 +in iso8859-15, tolower('0xb4') gives 0xb8</pre></div> </div> <h3 id="References"> References</h3> <ul> +<li> C17 standard (ISO/IEC 9899:2018): </li> +<ul><li> 7.4.2.1 The tolower function (p: 147) </li></ul> +<li> C11 standard (ISO/IEC 9899:2011): </li> +<ul><li> 7.4.2.1 The tolower function (p: 203) </li></ul> +<li> C99 standard (ISO/IEC 9899:1999): </li> +<ul><li> 7.4.2.1 The tolower function (p: 184) </li></ul> +<li> C89/C90 standard (ISO/IEC 9899:1990): </li> +<ul><li> 4.3.2.1 The tolower function </li></ul> +</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="toupper" title="c/string/byte/toupper"> <span class="t-lines"><span>toupper</span></span></a></div> </td> <td> converts a character to uppercase <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="../wide/towlower" title="c/string/wide/towlower"> <span class="t-lines"><span>towlower</span></span></a></div> +<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> converts a wide character to lowercase <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/string/byte/tolower" title="cpp/string/byte/tolower">C++ documentation</a></span> for <code>tolower</code> </td> +</tr> </table> <div class="_attribution"> + <p class="_attribution-p"> + © cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br> + <a href="https://en.cppreference.com/w/c/string/byte/tolower" class="_attribution-link">https://en.cppreference.com/w/c/string/byte/tolower</a> + </p> +</div> |
