Change a variable using serial

My code

String serial;
int dotLocation[] = {};

int a = 0;
int r = 0;
int g = 0;
int b = 0;



void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  serial = Serial.readString();

  for(int i = 0;i<serial.length();i++) {
    if (serial.charAt(0) == 'i') {
      while(serial.charAt(i) == isAlphaNumeric) {
        Serial.println(i);
        a = serial.charAt(i);
      }
  }
  Serial.println(a);
  }
}

So my problem is that i want every number after i to be added to the variable a;
But for some reason it doesn't add anything so the value of that variable stays at 0;
Can you guys take a look at my code and tell what's wrong. I am in a kind of a hurry because i would want my code to be finished in time for a demoparty.

Your use of isAlphaNumeric is wrong.

See isAlphaNumeric() - Arduino Reference.

Thank you for a quick response. What should i use instead to detect if the character is a numeral?

What I was trying to indicate is that isAlphaNumeric is a function and it takes a parameter. See the example in the link I gave you.

By the way, if you want to check for numbers only, isNumeric is the correct function.