WString: add `toDouble`

`toFloat` internally converts into double and then truncates into a
float, so why not add a method to return the double?
This commit is contained in:
Iván Pérez 2016-09-12 08:56:02 +02:00
parent 0f959829ba
commit b74a02cb21
2 changed files with 8 additions and 2 deletions

View File

@ -740,6 +740,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;
}

View File

@ -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