PaulS:
It HAS been answered. If you check, BEFORE you call atoi() that there are, or are not, invalid characters in the input, and, despite the string being "Wednesday", you call atoi() anyway, you deserve to flounder around trying to understand that 0 means error instead of a zero distance/number of minutes/whatever.
The tongue in check is not necessary.
That is not the method in your previous answer.
PaulS:
a smart person...would not store anything that was not a digit into the array to be passed to atoi().
Which happens to form a catch-22 with
PaulS:
If there is already something in the data that distinguishes the various kinds of data (dates contain slashes; time contains colons; RGB values contain commas, etc.), then you can look for the different separators, and call a function to parse that kind of data. For instance, if strstr() reports that the string contains a slash, call parseDate() with the string. If strstr() reports that the string contains a colon, call parseTime() with the string.
As I noted in
adwsystems:
the test for the colon or slashes is not done until after end character is received. While receiving data I don't know what is being received (date, time, int, or real value).
I understand your current method, insert a step between the serial input buffer and the call to atoi() to verify the data "integrity".