Having trouble with parseInt
in
Programming Questions
•
4 months ago
I am doing a massive project with hundreds of lines of code spanning a couple applications and many files.
One thing it does is read emails which come in to a certain account. I originally had it send the content to my Arduino and there did parseInt() and that was great. The code has grown though and my Arduino is getting mixed up and sending stuff at random. I estimate I can get a performance increase by processing the content inside Processing rather than on the Arduino.
All this said, I am sending an email with a 3 in it to this inbox. I need processing to look through the string (which I call content) and find the integer, and store it for the rest of the code to reference. I heard that you can do something like
- Integer.parseInt("String");
- java.lang.NumberFormatException: For input string: "3
- "
So that it what it returns. Reading the charAt(0) was an option, but if that address receives an email which is not a command, it will take a letter (such as "H") and return the corresponding int value (ASCII table confirms this). If someone knows how to take
- String content = message[i].getContent().toString();
1