mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-08 06:55:36 +08:00
41 lines
1.2 KiB
HTML
41 lines
1.2 KiB
HTML
<h1>字符函数 - ispunct</h1>
|
||
|
||
|
||
<p>原型:extern int ispunct(int c);</p>
|
||
|
||
<p>用法:#include <ctype.h></p>
|
||
|
||
<p>功能:判断字符c是否为标点符号</p>
|
||
|
||
<p>说明:当c为标点符号时,返回非零值,否则返回零。
|
||
标点符号指那些既不是字母数字,也不是空格的可打印字符。</p>
|
||
|
||
举例:<pre><code class="language-c">
|
||
|
||
// ispunct.c
|
||
|
||
#include <syslib.h>
|
||
#include <ctype.h>
|
||
#include <string.h>
|
||
|
||
main()
|
||
{
|
||
char s[]="Hello, Rain!";
|
||
int i;
|
||
|
||
clrscr(); // clear screen
|
||
printf("%s\n",s);
|
||
for(i=0;i<strlen(s);i++)
|
||
{
|
||
if(ispunct(s[i])) printf("^");
|
||
else printf(".");
|
||
}
|
||
|
||
|
||
getchar();
|
||
return 0;
|
||
}
|
||
|
||
</code></pre>相关函数:<a href="isalnum.html">isalnum</a>,<a href="isalpha.html">isalpha</a>,<a href="isdigit.html">isdigit</a>,<a href="isxdigit.html">isxdigit</a>,<a href="iscntrl.html">iscntrl</a>,<a href="isgraph.html">isgraph</a>,<a href="isprint.html">isprint</a>,<a href=isspace.html">isspace</a>
|
||
|