isAlphaNumeric()

Last revision:2025/04/24

名称

isAlphaNumeric()

説明

文字がアルファベットか数字のいずれかであるかを調べる。入力された文字がアルファベットか数字であれば、trueを返す。

書式

文字変数を評価するには、以下の関数を使う。

isAlphaNumeric(thisChar)

C言語シグネチャ(avr)

inline boolean isAlphaNumeric(int c);

引数

この関数は以下の引数を受け付ける。

thisChar調べたい文字。データ型: char

戻り値

この関数は、評価した入力変数がアルファベットか数字の場合、trueを返す。

コード例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
char myChar = '3'; // try with '#' for a non alphanumeric char 

void setup() {
  Serial.begin(9600);

  if (isAlphaNumeric(myChar)) {  // tests if myChar is a letter or a number
    Serial.println("The character is alphanumeric");
  } else {
    Serial.println("The character is not alphanumeric");
  }
}

void loop() {
}

参照

訳者註

内部ではisalnum()を呼び出しています。

オリジナルのページ

https://docs.arduino.cc/language-reference/en/functions/characters/isAlphaNumeric/

実装の解析

まだ解析していません。

最終更新日

August 16, 2026

inserted by FC2 system