diff --git a/build/shared/examples/8.Strings/CharacterAnalysis/CharacterAnalysis.pde b/build/shared/examples/8.Strings/CharacterAnalysis/CharacterAnalysis.pde index 602aa29fd..12baca9af 100644 --- a/build/shared/examples/8.Strings/CharacterAnalysis/CharacterAnalysis.pde +++ b/build/shared/examples/8.Strings/CharacterAnalysis/CharacterAnalysis.pde @@ -1,8 +1,7 @@ /* Character analysis operators - Examples using the character analysis operators - from WCharacter.h, by Hernando Barragan. + Examples using the character analysis operators. Send any byte and the sketch will tell you about it. created 29 Nov 2010 @@ -11,8 +10,6 @@ This example code is in the public domain. */ -#include // include the character analysis library - void setup() { // Open serial communications: Serial.begin(9600); diff --git a/build/shared/examples/8.Strings/StringToInt/StringToInt.pde b/build/shared/examples/8.Strings/StringToInt/StringToInt.pde index e27fd26e2..a045ba327 100644 --- a/build/shared/examples/8.Strings/StringToInt/StringToInt.pde +++ b/build/shared/examples/8.Strings/StringToInt/StringToInt.pde @@ -13,9 +13,6 @@ This example code is in the public domain. */ -// include the character conversion functions: -#include - String inString = ""; // string to hold input void setup() { diff --git a/build/shared/examples/8.Strings/StringToIntRGB/StringToIntRGB.pde b/build/shared/examples/8.Strings/StringToIntRGB/StringToIntRGB.pde index 8b36efbd0..342739db2 100644 --- a/build/shared/examples/8.Strings/StringToIntRGB/StringToIntRGB.pde +++ b/build/shared/examples/8.Strings/StringToIntRGB/StringToIntRGB.pde @@ -20,9 +20,6 @@ This example code is in the public domain. */ -// include the character conversion functions: -#include - String inString = ""; // string to hold input int currentColor = 0; int red, green, blue = 0; diff --git a/hardware/arduino/cores/arduino/WCharacter.h b/hardware/arduino/cores/arduino/WCharacter.h index 9b3e7fca5..79733b50a 100644 --- a/hardware/arduino/cores/arduino/WCharacter.h +++ b/hardware/arduino/cores/arduino/WCharacter.h @@ -20,8 +20,7 @@ #ifndef Character_h #define Character_h - -#include "WProgram.h" +#include // 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/hardware/arduino/cores/arduino/WProgram.h b/hardware/arduino/cores/arduino/WProgram.h index 5afecb48c..f73e760bb 100755 --- a/hardware/arduino/cores/arduino/WProgram.h +++ b/hardware/arduino/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/hardware/arduino/cores/arduino/WString.cpp b/hardware/arduino/cores/arduino/WString.cpp index b13123b99..4de929616 100644 --- a/hardware/arduino/cores/arduino/WString.cpp +++ b/hardware/arduino/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); }