📄 all.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <meta name="generator" content= "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org"> <title>Standard C String and Character</title> <link href="../cppreference.css" rel="stylesheet" type="text/css"></head><body><table> <tr> <td> <div class="body-content"> <div class="header-box"> <a href="../index.html">cppreference.com</a> > <a href= "index.html">Standard C String and Character</a> </div> <div class="name-format"> atof </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <stdlib.h> double atof( const char *str );</pre> <p>The function atof() converts <em>str</em> into a double, then returns that value. <em>str</em> must start with a valid number, but can be terminated with any non-numerical character, other than "E" or "e". For example,</p> <pre class="example-code"> x = atof( "42.0is_the_answer" ); </pre> <p>results in x being set to 42.0.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="atoi.html">atoi</a><br> <a href="atol.html">atol</a><br> (Standard C I/O) <a href="../stdio/sprintf.html">sprintf</a><br> <a href="strtod.html">strtod</a> </div> </div> </td> </tr> </table></body></html><hr><hr><hr> <div class="name-format"> atoi </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <stdlib.h> int atoi( const char *str );</pre> <p>The atoi() function converts <em>str</em> into an integer, and returns that integer. <em>str</em> should start with whitespace or some sort of number, and atoi() will stop reading from <em>str</em> as soon as a non-numerical character has been read. For example:</p> <pre class="example-code"> int i; i = atoi( "512" ); i = atoi( "512.035" ); i = atoi( " 512.035" ); i = atoi( " 512+34" ); i = atoi( " 512 bottles of beer on the wall" );</pre> <p>All five of the above assignments to the variable <em>i</em> would result in it being set to 512.</p> <p>If the conversion cannot be performed, then atoi() will return zero:</p> <pre class="example-code"> int i = atoi( " does not work: 512" ); // results in i == 0</pre> <p>You can use <a href= "../stdio/sprintf.html">sprintf</a>() to convert a number into a string.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="atof.html">atof</a><br> <a href="atol.html">atol</a><br> (Standard C I/O) <a href="../stdio/sprintf.html">sprintf</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> atol </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <stdlib.h> long atol( const char *str );</pre> <p>The function atol() converts <em>str</em> into a long, then returns that value. atol() will read from <em>str</em> until it finds any character that should not be in a long. The resulting truncated value is then converted and returned. For example,</p> <pre class="example-code"> x = atol( "1024.0001" ); </pre> <p>results in x being set to 1024L.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="atof.html">atof</a><br> <a href="atoi.html">atoi</a><br> (Standard C I/O) <a href="../stdio/sprintf.html">sprintf</a><br> <a href="strtol.html">strtol</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> isalnum </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <ctype.h> int isalnum( int ch );</pre> <p>The function isalnum() returns non-zero if its argument is a numeric digit or a letter of the alphabet. Otherwise, zero is returned.</p> <pre class="example-code"> char c; scanf( "%c", &c ); if( isalnum(c) ) printf( "You entered the alphanumeric character %c\n", c ); </pre> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="isalpha.html">isalpha</a><br> <a href="iscntrl.html">iscntrl</a><br> <a href="isdigit.html">isdigit</a><br> <a href="isgraph.html">isgraph</a><br> <a href="isprint.html">isprint</a><br> <a href="ispunct.html">ispunct</a><br> <a href="isspace.html">isspace</a><br> <a href="isxdigit.html">isxdigit</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> isalpha </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <ctype.h> int isalpha( int ch );</pre> <p>The function isalpha() returns non-zero if its argument is a letter of the alphabet. Otherwise, zero is returned.</p> <pre class="example-code"> char c; scanf( "%c", &c ); if( isalpha(c) ) printf( "You entered a letter of the alphabet\n" ); </pre> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="isalnum.html">isalnum</a><br> <a href="iscntrl.html">iscntrl</a><br> <a href="isdigit.html">isdigit</a><br> <a href="isgraph.html">isgraph</a><br> <a href="isprint.html">isprint</a><br> <a href="ispunct.html">ispunct</a><br> <a href="isspace.html">isspace</a><br> <a href="isxdigit.html">isxdigit</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> iscntrl </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <ctype.h> int iscntrl( int ch );</pre> <p>The iscntrl() function returns non-zero if its argument is a control character (between 0 and 0x1F or equal to 0x7F). Otherwise, zero is returned.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="isalnum.html">isalnum</a><br> <a href="isalpha.html">isalpha</a><br> <a href="isdigit.html">isdigit</a><br> <a href="isgraph.html">isgraph</a><br> <a href="isprint.html">isprint</a><br> <a href="ispunct.html">ispunct</a><br> <a href="isspace.html">isspace</a><br> <a href="isxdigit.html">isxdigit</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> isdigit </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <ctype.h> int isdigit( int ch );</pre> <p>The function isdigit() returns non-zero if its argument is a digit between 0 and 9. Otherwise, zero is returned.</p> <pre class="example-code"> char c; scanf( "%c", &c ); if( isdigit(c) ) printf( "You entered the digit %c\n", c ); </pre> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="isalnum.html">isalnum</a><br> <a href="isalpha.html">isalpha</a><br> <a href="iscntrl.html">iscntrl</a><br> <a href="isgraph.html">isgraph</a><br> <a href="isprint.html">isprint</a><br> <a href="ispunct.html">ispunct</a><br> <a href="isspace.html">isspace</a><br> <a href="isxdigit.html">isxdigit</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> isgraph </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <ctype.h> int isgraph( int ch );</pre> <p>The function isgraph() returns non-zero if its argument is any printable character other than a space (if you can see the character, then isgraph() will return a non-zero value). Otherwise, zero is returned.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="isalnum.html">isalnum</a><br> <a href="isalpha.html">isalpha</a><br> <a href="iscntrl.html">iscntrl</a><br> <a href="isdigit.html">isdigit</a><br> <a href="isprint.html">isprint</a><br> <a href="ispunct.html">ispunct</a><br> <a href="isspace.html">isspace</a><br> <a href="isxdigit.html">isxdigit</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> islower </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <ctype.h> int islower( int ch );</pre> <p>The islower() function returns non-zero if its argument is a lowercase letter. Otherwise, zero is returned.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="isupper.html">isupper</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> isprint </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <ctype.h> int isprint( int ch );</pre> <p>The function isprint() returns non-zero if its argument is a printable character (including a space). Otherwise, zero is returned.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="isalnum.html">isalnum</a><br> <a href="isalpha.html">isalpha</a><br> <a href="iscntrl.html">iscntrl</a><br> <a href="isdigit.html">isdigit</a><br> <a href="isgraph.html">isgraph</a><br> <a href="ispunct.html">ispunct</a><br> <a href="isspace.html">isspace</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> ispunct </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <ctype.h> int ispunct( int ch );</pre> <p>The ispunct() function returns non-zero if its argument is a printing character but neither alphanumeric nor a space. Otherwise, zero is returned.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="isalnum.html">isalnum</a><br> <a href="isalpha.html">isalpha</a><br> <a href="iscntrl.html">iscntrl</a><br> <a href="isdigit.html">isdigit</a><br> <a href="isgraph.html">isgraph</a><br> <a href="isprint.html">isprint</a><br> <a href="isspace.html">isspace</a><br> <a href="isxdigit.html">isxdigit</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> isspace </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <ctype.h> int isspace( int ch );</pre> <p>The isspace() function returns non-zero if its argument is some sort of space (i.e. single space, tab, vertical tab, form feed, carriage return, or newline). Otherwise, zero is returned.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="isalnum.html">isalnum</a><br> <a href="isalpha.html">isalpha</a><br> <a href="iscntrl.html">iscntrl</a><br> <a href="isdigit.html">isdigit</a><br> <a href="isgraph.html">isgraph</a><br> <a href="isprint.html">isprint</a><br> <a href="ispunct.html">ispunct</a><br> <a href="isxdigit.html">isxdigit</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> isupper </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <ctype.h> int isupper( int ch );</pre> <p>The isupper() function returns non-zero if its argument is an uppercase letter. Otherwise, zero is returned.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="islower.html">islower</a><br> <a href="tolower.html">tolower</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> isxdigit </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <ctype.h> int isxdigit( int ch );</pre> <p>The function isxdigit() returns non-zero if its argument is a hexidecimal digit (i.e. A-F, a-f, or 0-9). Otherwise, zero is returned.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="isalnum.html">isalnum</a><br> <a href="isalpha.html">isalpha</a><br> <a href="iscntrl.html">iscntrl</a><br> <a href="isdigit.html">isdigit</a><br> <a href="isgraph.html">isgraph</a><br> <a href="ispunct.html">ispunct</a><br> <a href="isspace.html">isspace</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -