[Characters]
isAlphaNumeric(thisChar)
描述
Analyse if a char is alphanumeric (a-z or A-Z or 0-9).
參數
thisChar
: the char to be analysed.
回傳
True or false.
isAlpha(thisChar)
描述
Analyse if a char is is alpha (a-z or A-Z).
參數
thisChar
: the char to be analysed
回傳
True or false.
isAscii(thisChar)
描述
Analyse if a char is ASCII. (Visit the wiki website to get the detail for ASCII character set)
參數
thisChar
: the char to be analysed
回傳
True or false.
isWhitespace(thisChar)
描述
Analyse if a char is a white space (‘ ‘ or ‘\t’).
參數
thisChar
: the char to be analysed
回傳
True or false.
isControl(thisChar)
描述
Analyse if a char is a control character. (Visit the wiki website to get detail for control character)
參數
thisChar
: the char to be analysed
回傳
True or false.
isDigit(thisChar)
描述
Analyse if a char is a digit (0-9).
參數
thisChar
: the char to be analysed
回傳
True or false.
isGraph(thisChar)
描述
Analyse if a char is a printable character (not including space character: ‘ ‘).
參數
thisChar
: the char to be analysed
回傳
True or false.
isLowerCase(thisChar)
描述
Analyse if a char is a lower case character.
參數
thisChar
: the char to be analysed
回傳
True or false.
isPrintable(thisChar)
描述
Analyse if a char is a printable character (including space character: ‘ ‘).
參數
thisChar
: the char to be analysed
回傳
True or false.
isPunct(thisChar)
描述
Analyse if a char is punctuation character.
參數
thisChar
: the char to be analysed
回傳
True or false.
isSpace(thisChar)
描述
Analyse if a char is a space character (‘ ‘, ‘\f’, ‘\n’, ‘\r’, ‘\t’, ‘\v’ characters).
參數
thisChar
: the char to be analysed
回傳
True or false.
isUpperCase(thisChar)
描述
Analyse if a char is an upper case character.
參數
thisChar
: the char to be analysed
回傳
True or false.
isHexadecimalDigit(thisChar)
描述
Analyse if a char is a valid hexadecimal digit (0-9 and A-F).
參數
thisChar
: the char to be analysed
回傳
True or false.
範例程式碼
/* Character analysis operators Examples using the character analysis operators. Send any byte and the sketch will tell you about it. created 29 Nov 2010 modified 2 Apr 2012 by Tom Igoe This example code is in the public domain. */ void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } // send an intro: Serial.println("send any byte and I'll tell you everything I can about it"); Serial.println(); } void loop() { // get any incoming bytes: if (Serial.available() > 0) { int thisChar = Serial.read(); // say what was sent: Serial.print("You sent me: \'"); Serial.write(thisChar); Serial.print("\' ASCII Value: "); Serial.println(thisChar); // analyze what was sent: if (isAlphaNumeric(thisChar)) { Serial.println("it's alphanumeric"); } if (isAlpha(thisChar)) { Serial.println("it's alphabetic"); } if (isAscii(thisChar)) { Serial.println("it's ASCII"); } if (isWhitespace(thisChar)) { Serial.println("it's whitespace"); } if (isControl(thisChar)) { Serial.println("it's a control character"); } if (isDigit(thisChar)) { Serial.println("it's a numeric digit"); } if (isGraph(thisChar)) { Serial.println("it's a printable character that's not whitespace"); } if (isLowerCase(thisChar)) { Serial.println("it's lower case"); } if (isPrintable(thisChar)) { Serial.println("it's printable"); } if (isPunct(thisChar)) { Serial.println("it's punctuation"); } if (isSpace(thisChar)) { Serial.println("it's a space character"); } if (isUpperCase(thisChar)) { Serial.println("it's upper case"); } if (isHexadecimalDigit(thisChar)) { Serial.println("it's a valid hexadecimaldigit (i.e. 0 - 9, a - F, or A - F)"); } // add some space and ask for another byte: Serial.println(); Serial.println("Give me another byte:"); Serial.println(); } }
語法參考主頁面
86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。