iswblank() ตรวจสอบ wide character ว่าเป็น blank (space หรือ tab \t) หรือไม่ ประกาศใน ctype.h (C) หรือ cctype (C++)
ไวยากรณ์
int iswblank(wint_t char);
ตัวอย่าง
#include <ctype.h>
#include <iostream>
using namespace std;
int main() {
wchar_t s[] = L"The space between words.";
int i = 0, count = 0;
while(s[i]) {
char c = s[i++];
if(iswblank(c))
count++;
}
cout << "\nNumber of blanks in sentence: " << count << endl;
return 0;
}ผลลัพธ์
Number of blanks in sentence: 5
นับช่องว่าง (space) ในประโยค "The space between words." ได้ 5 ช่อง