If the last character of s is c, remove it and return true. */
| 19 | |
| 20 | /** If the last character of s is c, remove it and return true. */ |
| 21 | static inline bool chomp(std::string& s, char c = '\n') |
| 22 | { |
| 23 | unsigned back = s.length() - 1; |
| 24 | if (!s.empty() && s[back] == c) { |
| 25 | s.erase(back); |
| 26 | return true; |
| 27 | } else |
| 28 | return false; |
| 29 | } |
| 30 | |
| 31 | /** Return the SI representation of n. */ |
| 32 | static inline std::string toSI(double n) |