aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/WString.cpp
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2010-12-03 23:12:41 -0500
committerDavid A. Mellis <d.mellis@arduino.cc>2010-12-03 23:12:41 -0500
commit053ec1b989085e0d59f84ded8641058715701a8b (patch)
tree04bc744b58ddb6fcf71a80bbbf37a5146da43f5e /cores/arduino/WString.cpp
parent4fefe032a53667cba2b801d0cc5f021b3d457ddd (diff)
Replacing custom String.toInt() function with a call to atol().
Diffstat (limited to 'cores/arduino/WString.cpp')
-rw-r--r--cores/arduino/WString.cpp13
1 files changed, 1 insertions, 12 deletions
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);
}