We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
toDouble
1 parent 7615905 commit c134154Copy full SHA for c134154
cores/arduino/WString.cpp
@@ -810,6 +810,11 @@ long String::toInt(void) const
810
811
float String::toFloat(void) const
812
{
813
- if (buffer) return float(atof(buffer));
814
- return 0;
+ return (float)toDouble();
+}
815
+
816
+double String::toDouble(void) const
817
+{
818
+ if (buffer) return atof(buffer);
819
+ return 0;
820
}
cores/arduino/WString.h
@@ -199,6 +199,7 @@ class String
199
// parsing/conversion
200
long toInt(void) const;
201
float toFloat(void) const;
202
+ double toDouble(void) const;
203
char * getCSpec(int base, bool issigned, bool islong);
204
205
protected:
0 commit comments