函式
<cwctype>

iswblank

int iswblank (wint_t c);
檢查寬字元是否為空格字元
檢查c是否為空白字元

空白字元”是指用於分隔文字行中單詞的空格字元

標準"C"區域設定將製表符(L'\t')和空格符(L' ').

)視為空白字元。其他區域設定可能將不同的字元集視為空白字元,但根據isspace,它們都必須是空格字元

此函式是isblank<cctype>)的寬字元等效函式:如果c透過wctob轉換為一個函式isblank返回true的字元,那麼此函式也總是將其視為空白字元。

在C++中,此函式有一個特定於區域設定的模板版本(isblank),它位於標頭<locale>中,適用於所有字元型別。

引數

c
要檢查的寬字元,強制轉換為wint_t型別,或WEOF.
wint_t 是一個整數型別。

返回值

如果 c 確實是空白字元,則返回一個非零值(即true)如果c確實是一個空白字元。零(即false)。

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* iswblank example */
#include <stdio.h>
#include <wctype.h>
int main ()
{
  wchar_t c;
  int i=0;
  wchar_t str[] = L"Example sentence to test iswblank\n";
  while (str[i])
  {
    c = str[i];
    if (iswblank(c)) c = L'\n';
    putwchar (c);
    i++;
  }
  return 0;
}

輸出
Example
sentence
to
test
iswblank


另見