如何在 Arduino 中使用 isGraph()?
isGraph() 函数与 Arduino 中的 isPrintable() 函数非常类似。唯一的区别是 isGraph() 仅在打印的字符具有一定内容时返回真。因此,空白会被 isGraph() 排除在外,但会被 isPrintable() 包含在内。所有具有内容的普通字符、数字、特殊字符通过 isGraph() 时都会返回真。
语法
语法如下 −
isGraph(myChar)
其中 myChar 是正在检查的字符。一个简单的问题。制表符和换行符是否会通过 isGraph() 返回真。
示例
用下面类似的简单代码验证你的答案 −
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println();
char myChar = '
';
if (isGraph(myChar)) {
Serial.println("myChar is printable with content");
} else {
Serial.println("myChar is NOT printable with content");
}
}
void loop() {
// put your main code here, to run repeatedly:
}
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP