mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-30 09:37:53 -04:00
Add file reader (#1155)
* Add file reader * Add a simple test example of parsing settings. * Use new FileLineReader to parse Glass presets * Trim CRLF from Glass preset name
This commit is contained in:
parent
a5c7eb2fbc
commit
34fefd1cad
11 changed files with 659 additions and 325 deletions
|
@ -281,14 +281,16 @@ double get_decimals(double num, int16_t mult, bool round) {
|
|||
return intnum;
|
||||
}
|
||||
|
||||
static const char* whitespace_str = " \t\r\n";
|
||||
|
||||
std::string trim(const std::string& str) {
|
||||
auto first = str.find_first_not_of(' ');
|
||||
auto last = str.find_last_not_of(' ');
|
||||
auto first = str.find_first_not_of(whitespace_str);
|
||||
auto last = str.find_last_not_of(whitespace_str);
|
||||
return str.substr(first, last - first);
|
||||
}
|
||||
|
||||
std::string trimr(std::string str) {
|
||||
size_t last = str.find_last_not_of(' ');
|
||||
std::string trimr(const std::string& str) {
|
||||
size_t last = str.find_last_not_of(whitespace_str);
|
||||
return (last != std::string::npos) ? str.substr(0, last + 1) : ""; // Remove the trailing spaces
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue