Namespaces
Variants
Actions

iswspace

From cppreference.com
< c‎ | string‎ | wide
Defined in header <wctype.h>
int iswspace( wint_t ch );
(since C95)

Checks if the given wide character is a whitespace character, i.e. either space (0x20), form feed (0x0c), line feed (0x0a), carriage return (0x0d), horizontal tab (0x09), vertical tab (0x0b) or any whitespace character specific to the current locale.

Contents

[edit] Parameters

ch - wide character

[edit] Return value

Non-zero value if the wide character is a whitespace character, zero otherwise.

[edit] Notes

ISO 30112 defines POSIX space characters as Unicode characters U+0009..U+000D, U+0020, U+1680, U+180E, U+2000..U+2006, U+2008..U+200A, U+2028, U+2029, U+205F, and U+3000.

[edit] Example

#include <locale.h>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
 
int main(void)
{
    wchar_t c = L'\u2003'; // Unicode character 'EM SPACE'
    printf("In the default locale, iswspace(%#x) = %d\n", c, !!iswspace(c));
    setlocale(LC_ALL, "en_US.utf8");
    printf("In Unicode locale, iswspace(%#x) = %d\n", c, !!iswspace(c));
}

Output:

In the default locale, iswspace(0x2003) = 0
In Unicode locale, iswspace(0x2003) = 1

[