function
<cctype>
isblank
Check if character is blank
Checks whether c is a blank character.
A blank character is a space character used to separate words within a line of text.
The standard "C" locale considers blank characters the tab character ('\t') and the space character (' ').
Other locales may consider blank a different selection of characters, but they must all also be space characters by isspace.
For a detailed chart on what the different ctype functions return for each character of the standard ASCII character set, see the reference for the <cctype> header.
In C++, a locale-specific template version of this function (isblank) exists in header <locale>.
Compatibility note: Standardized in C99 (C++11).
Parameters
- c
- Character to be checked, casted to an int, or EOF.
Return Value
A value different from zero (i.e., true) if indeed c is a blank character. Zero (i.e., false) otherwise.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
/* 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;
}
|
This code prints out the C string character by character, replacing any blank character by a newline character. Output:
Example
sentence
to
test
isblank
|
See also
- isspace
- Check if character is a white-space (function
)
- isgraph
- Check if character has graphical representation (function
)
- ispunct
- Check if character is a punctuation character (function
)
- isalnum
- Check if character is alphanumeric (function
)
- isblank (locale)
- Check if character is blank using locale (function template
)