diff --git a/firmware/application/string_format.cpp b/firmware/application/string_format.cpp index 3529a2d7..0af9dc3d 100644 --- a/firmware/application/string_format.cpp +++ b/firmware/application/string_format.cpp @@ -255,3 +255,9 @@ double get_decimals(double num, int16_t mult, bool round) { if (num > .5) intnum++; //Round up return intnum; } + +std::string trimr(std::string str) +{ + size_t last = str.find_last_not_of(' '); + return (last!=std::string::npos) ? str.substr(0, last+1) : ""; // Remove the trailing spaces +} \ No newline at end of file diff --git a/firmware/application/string_format.hpp b/firmware/application/string_format.hpp index db32072e..848a53e3 100644 --- a/firmware/application/string_format.hpp +++ b/firmware/application/string_format.hpp @@ -58,4 +58,7 @@ std::string to_string_FAT_timestamp(const FATTimestamp& timestamp); std::string unit_auto_scale(double n, const uint32_t base_nano, uint32_t precision); double get_decimals(double num, int16_t mult, bool round = false); //euquiq added + +std::string trimr(std::string str); // Remove trailing spaces + #endif/*__STRING_FORMAT_H__*/