How to Use isGraph() in Arduino?


The isGraph() function is very similar to the isPrintable() function in Arduino. The only difference is that isGraph() returns true only if the character being printed has some content.So, blank space gets excluded by isGraph() but included by isPrintable(). All normal characters, numbers, special characters, which have some content will return true when passed through isGraph().

Syntax

The syntax is −

isGraph(myChar)

Where myChar is the character being checked. A quick question. Will the tab and new line characters return true with isGraph().

Example

Validate your answer with a simple code like below −

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: }

Updated on: 30-Jul-2021

187 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements