mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
parent
e3de77f671
commit
3b9db65ea3
@ -829,17 +829,24 @@ void String::trim(void) {
|
|||||||
// /*********************************************/
|
// /*********************************************/
|
||||||
|
|
||||||
long String::toInt(void) const {
|
long String::toInt(void) const {
|
||||||
if(buffer())
|
if (buffer())
|
||||||
return atol(buffer());
|
return atol(buffer());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float String::toFloat(void) const {
|
float String::toFloat(void) const {
|
||||||
if(buffer())
|
if (buffer())
|
||||||
return atof(buffer());
|
return atof(buffer());
|
||||||
return 0;
|
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
|
// global empty string to allow returning const String& with nothing
|
||||||
|
|
||||||
const String emptyString;
|
const String emptyString;
|
||||||
|
@ -241,6 +241,7 @@ class String {
|
|||||||
// parsing/conversion
|
// parsing/conversion
|
||||||
long toInt(void) const;
|
long toInt(void) const;
|
||||||
float toFloat(void) const;
|
float toFloat(void) const;
|
||||||
|
double toDouble(void) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Contains the string info when we're not in SSO mode
|
// Contains the string info when we're not in SSO mode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user