function
<cwctype>
iswspace
Check if wide character is a white-space
Checks whether c is a white-space character.
A white-space is a character considered by a specific locale as a space separating words, lines and/or paragraphs.
This function is the wide-character equivalent of isspace (<cctype>): If c translates with wctob to a character for which isspace is true, it is always considered a white-space character by this function too.
In C++, a locale-specific template version of this function (isspace) exists in header <locale> for all character types.
Parameters
- c
- Wide character to be checked, casted to a wint_t, or WEOF.
wint_t is an integral type.
Return Value
A value different from zero (i.e., true) if indeed c is a white-space character. Zero (i.e., false) otherwise.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
/* iswspace example */
#include <stdio.h>
#include <wctype.h>
int main ()
{
wchar_t c;
int i=0;
wchar_t str[] = L"Example sentence to test iswspace\n";
while (str[i])
{
c=str[i];
if (iswspace(c)) c = L'\n';
putwchar (c);
i++;
}
return 0;
}
| |
Output:
Example
sentence
to
test
iswspace
|
See also
- isspace
- Check if character is a white-space (function
)
- iswgraph
- Check if wide character has graphical representation (function
)
- iswpunct
- Check if wide character is punctuation character (function
)
- isspace (locale)
- Check if character is a white-space using locale (function template
)