From 053ec1b989085e0d59f84ded8641058715701a8b Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Fri, 3 Dec 2010 23:12:41 -0500 Subject: Replacing custom String.toInt() function with a call to atol(). --- cores/arduino/WString.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'cores/arduino/WString.cpp') 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); } -- cgit v1.2.3-18-g5258