diff options
-rw-r--r-- | cores/arduino/WCharacter.h | 7 | ||||
-rwxr-xr-x | cores/arduino/WProgram.h | 1 | ||||
-rw-r--r-- | cores/arduino/WString.cpp | 13 |
3 files changed, 5 insertions, 16 deletions
diff --git a/cores/arduino/WCharacter.h b/cores/arduino/WCharacter.h index 9b3e7fc..79733b5 100644 --- a/cores/arduino/WCharacter.h +++ b/cores/arduino/WCharacter.h @@ -20,8 +20,7 @@ #ifndef Character_h #define Character_h - -#include "WProgram.h" +#include <ctype.h> // WCharacter.h prototypes inline boolean isAlphaNumeric(int c) __attribute__((always_inline)); @@ -117,8 +116,8 @@ inline boolean isPunct(int c) // Checks for white-space characters. For the avr-libc library, -// these are: space, formfeed (’\f’), newline (’\n’), carriage -// return (’\r’), horizontal tab (’\t’), and vertical tab (’\v’). +// these are: space, formfeed ('\f'), newline ('\n'), carriage +// return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). inline boolean isSpace(int c) { return ( isspace (c) == 0 ? false : true); diff --git a/cores/arduino/WProgram.h b/cores/arduino/WProgram.h index 5afecb4..f73e760 100755 --- a/cores/arduino/WProgram.h +++ b/cores/arduino/WProgram.h @@ -10,6 +10,7 @@ #include "wiring.h" #ifdef __cplusplus +#include "WCharacter.h" #include "WString.h" #include "HardwareSerial.h" diff --git a/cores/arduino/WString.cpp b/cores/arduino/WString.cpp index b13123b..4de9296 100644 --- a/cores/arduino/WString.cpp +++ b/cores/arduino/WString.cpp @@ -437,16 +437,5 @@ void String::toCharArray(char *buf, unsigned int bufsize) long String::toInt() { - String temp = _buffer; - long value = 0; - - for (unsigned int charPos = 0; charPos < _length; charPos++) { - int thisChar = temp[charPos]; - if (isdigit(thisChar)) { - value *= 10; - value += (thisChar - '0'); - } - } - - return value; + return atol(_buffer); } |