Split a string content by line feeds.
| 212 | |
| 213 | // Split a string content by line feeds. |
| 214 | inline StringVec SplitByLines(const std::string & str) |
| 215 | { |
| 216 | if (str.empty()) return {""}; |
| 217 | |
| 218 | StringVec results; |
| 219 | |
| 220 | std::stringstream ss(str); |
| 221 | std::string item; |
| 222 | while (std::getline(ss, item)) |
| 223 | { |
| 224 | results.push_back(std::move(item)); |
| 225 | } |
| 226 | |
| 227 | return results; |
| 228 | } |
| 229 | |
| 230 | // Split a string content by whitespaces i.e. ' ', tab. |
| 231 | inline StringVec SplitByWhiteSpaces(const std::string & str) |