Hello! I haven't been able to find a solution as to why this code doesn't work all the time. I am using an Arudino Uno with an Adafruit WINC1500 Wifi shield to retrieve random data from a website in the structure of two integers separated by a comma. (such as 13523,12312). The Arduino is retrieving the string integers without issue, but when i try to separate the string into two, it only works half the time. Here are the last 3 outputs i received and the code i am using.
33020,28150
IntegerA: -32516
IntegerB: 28150
7514,53132
IntegerA: 7514
IntegerB: -12404
19218,23369
IntegerA: 19218
IntegerB: 23369
int IntegerA = stringinput.substring(0, stringinput.indexOf(",")).toInt();
int IntegerB = stringinput.substring(stringinput.indexOf(",") + 1).toInt();
Serial.print("IntegerA: ");
Serial.println(IntegerA);
Serial.print("IntegerB: ");
Serial.println(IntegerB);