1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Add String::toDouble from upstream Arduino core (#5986)

Fixes #5985
This commit is contained in:
Earle F. Philhower, III 2019-04-14 15:33:15 -07:00 committed by david gauchard
parent e3de77f671
commit 3b9db65ea3
2 changed files with 10 additions and 2 deletions

View File

@ -840,6 +840,13 @@ float String::toFloat(void) const {
return 0;
}
double String::toDouble(void) const
{
if (buffer())
return atof(buffer());
return 0.0;
}
// global empty string to allow returning const String& with nothing
const String emptyString;

View File

@ -241,6 +241,7 @@ class String {
// parsing/conversion
long toInt(void) const;
float toFloat(void) const;
double toDouble(void) const;
protected:
// Contains the string info when we're not in SSO mode