| 21 | } |
| 22 | |
| 23 | static inline void replaceStrAll(std::string &str, const std::string &from, |
| 24 | const std::string &to) { |
| 25 | size_t start_pos = 0; |
| 26 | while ((start_pos = str.find(from, start_pos)) != std::string::npos) { |
| 27 | str.replace(start_pos, from.length(), to); |
| 28 | start_pos += |
| 29 | to.length(); // Handles case where 'to' is a substring of 'from' |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | // trim from start |
| 34 | static inline std::string ltrim(std::string s) { |