WString: add toDouble
Port of https://github.com/arduino/Arduino/pull/5362
This commit is contained in:
parent
fbbc70ead2
commit
c7c6f709b5
2 changed files with 7 additions and 1 deletions
|
|
@ -742,6 +742,11 @@ long String::toInt(void) const
|
|||
|
||||
float String::toFloat(void) const
|
||||
{
|
||||
if (buffer) return float(atof(buffer));
|
||||
return float(toDouble());
|
||||
}
|
||||
|
||||
double String::toDouble(void) const
|
||||
{
|
||||
if (buffer) return atof(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,6 +190,7 @@ public:
|
|||
// parsing/conversion
|
||||
long toInt(void) const;
|
||||
float toFloat(void) const;
|
||||
double toDouble(void) const;
|
||||
|
||||
protected:
|
||||
char *buffer; // the actual char array
|
||||
|
|
|
|||
Loading…
Reference in a new issue