isblank
函数 <cctype>
int isblank ( int c );
检查一个字符是否为空字符
检查c是否为空白字符
空白字符是用于在一行文本中分隔单词的空格字符。
标准的“C”语言环境认为制表符('\t')和空格字符(' ')是空白字符。
其他地区可能认为空白是一种不同的字符选择,但它们也必须都是
isspace的空格字符。
在c++中,该函数的特定区域的模板版本(isblank)存在于头文件<locale>中。
兼容性说明:在C99 (c++ 11)中标准化。
☲ 参数
c
要被检查、转换为int或EOF的字符。
☉ 返回值
如果c确实是一个空白字符,返回一个不等于零的值(如,true)。否则返回零(即false)。
☣ 示例
/* isblank example */
#include <stdio.h>
#include <ctype.h>
int main ()
{
char c;
int i=0;
char str[]="Example sentence to test isblank\n";
while (str[i])
{
c=str[i];
if (isblank(c)) c='\n';
putchar (c);
i++;
}
return 0;
} |
输出:
Example
sentence
to
test
isblank
🍄 另请参阅
isspace |
检查字符是否为空格(function ) |
isgraph |
检查字符是否是图形形式(function ) |
ispunct |
检查字符是否是标点符号(function ) |
isalnum |
检查字符是否是字母数字(function ) |
isblank (locale) |
使用区域设置检查字符是否为空(function template ) |