C Standard Library

C <wctype.h> - iswblank() Function



The C <wctype.h> iswblank() function is used to check if the given wide character is a wide blank character. Blank characters are whitespace characters used to separate words within a sentence. In the default "C" locale, only space (L' ', 0x20) and horizontal tab (L'\t', 0x09) are classified as wide blank characters. Other locales may consider a different selection of wide characters as wide blank characters.

Syntax

int iswblank ( wint_t ch ); 

Parameters

ch Specify the wide character to be checked, casted to an wint_t, or WEOF.

Return Value

Returns non-zero value (i.e, true) if ch is a wide blank character, else returns zero (i.e, false).

Example:

The example below shows the usage of iswblank() function.

#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
 
int main (){
  wchar_t str[50] = L"Not to\tbe";

  //replacing the wide blank character
  //with wide new line character in str
  int i = 0;
  while(str[i]) {
    if(iswblank(str[i]))
      str[i] = L'\n';
    i++;
  }

  //displaying the output
  printf("str contains:\n%ls", str);  
  return 0;
}

The output of the above code will be:

str contains:
Not
to
be

❮ C <wctype.h> Library