| 156 | } |
| 157 | |
| 158 | std::vector<std::string> split( const std::string& string, const std::string& delimiter ) |
| 159 | { |
| 160 | std::vector<std::string> res; |
| 161 | size_t pos = 0; |
| 162 | for ( ;;) |
| 163 | { |
| 164 | auto delimPos = string.find( delimiter, pos ); |
| 165 | res.push_back( string.substr( pos, delimPos - pos ) ); |
| 166 | if ( delimPos == std::string::npos ) |
| 167 | break; |
| 168 | pos = delimPos + delimiter.size(); |
| 169 | } |
| 170 | |
| 171 | return res; |
| 172 | } |
| 173 | |
| 174 | std::string replace( std::string target, std::string_view from, std::string_view to ) |
| 175 | { |