Go Down

Topic: Questions about Stream parse functions in Arduino 1.0 beta 3 (Read 1 time) previous topic - next topic


Here are three questions about Stream::parseInt() and Stream::parseFloat().

1. Why do they skip all leading characters except '-' and digits 0-9?  Why not just space like most parse functions?  Reading "abc123" as a valid number, 123, seems strange.

2. How can you tell if no digits were read?  The string "xyz" returns zero.

3. Why do they swallow the terminating non-digit?  Often this character is important.  If you call parseInt() with the string "567pq", 'p' is consumed and the next read returns 'q'.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131