We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
toDouble
1 parent fbbc70e commit c7c6f70Copy full SHA for c7c6f70
cores/arduino/WString.cpp
@@ -742,6 +742,11 @@ long String::toInt(void) const
742
743
float String::toFloat(void) const
744
{
745
- if (buffer) return float(atof(buffer));
+ return float(toDouble());
746
+}
747
+
748
+double String::toDouble(void) const
749
+{
750
+ if (buffer) return atof(buffer);
751
return 0;
752
}
cores/arduino/WString.h
@@ -190,6 +190,7 @@ class String
190
// parsing/conversion
191
long toInt(void) const;
192
float toFloat(void) const;
193
+ double toDouble(void) const;
194
195
protected:
196
char *buffer; // the actual char array
0 commit comments