mirror of
https://github.com/okalachev/flix.git
synced 2025-07-29 20:38:59 +00:00
Simplify and fix code
This commit is contained in:
parent
75127eb6f8
commit
51fa5a6cac
@ -33,17 +33,9 @@ class __FlashStringHelper;
|
|||||||
// https://www.arduino.cc/reference/en/language/variables/data-types/stringobject/
|
// https://www.arduino.cc/reference/en/language/variables/data-types/stringobject/
|
||||||
class String: public std::string {
|
class String: public std::string {
|
||||||
public:
|
public:
|
||||||
String(const char *str = "") : std::string(str ? str : "") {}
|
|
||||||
long toInt() const { return atol(this->c_str()); }
|
long toInt() const { return atol(this->c_str()); }
|
||||||
float toFloat() const { return atof(this->c_str()); }
|
float toFloat() const { return atof(this->c_str()); }
|
||||||
bool isEmpty() const { return this->empty(); }
|
bool isEmpty() const { return this->empty(); }
|
||||||
void toCharArray(char *buf, unsigned int bufsize, unsigned int index = 0) const {
|
|
||||||
strlcpy(buf, this->c_str() + index, bufsize);
|
|
||||||
}
|
|
||||||
void trim() {
|
|
||||||
this->erase(0, this->find_first_not_of(" \t\n\r"));
|
|
||||||
this->erase(this->find_last_not_of(" \t\n\r") + 1);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Print;
|
class Print;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user