isspace() checks for white-space characters. In the “C” and “POSIX” locales, these are: space, form-feed (‘\f’), newline (‘\n’), carriage return (‘\r’), horizontal tab (‘\t’), and vertical tab (‘\v’).
函数int isspace ( int c );
用便宜美国vps于判断字符c是否是空字符,是空字符返回值为非0,不是空字符返回值为0
例子判断字符串字符是否为空,是空字符,则将空字符替换成’#’
#include<stdio.h>#include<ctype.h>int main(){char c;int i=0;char str[]=”isspace test one”;while(str[i]){c=str[i];if(isspace(c))c=’#’;putchar(c);i++;}return 0;}
运行结果:
zdg@ubuntu:/mnt/hgfs/SHAREZDG/C_PROJECT$ ./a.out isspace#test#onezdg@ubuntu:/mnt/hgfs/SHAREZDG/C_PROJECT$
?
64467167