| 2510 | } |
| 2511 | |
| 2512 | std::vector<std::string> string_split( const std::string &text_in, char delim_in ) |
| 2513 | { |
| 2514 | std::vector<std::string> elems; |
| 2515 | |
| 2516 | if( text_in.empty() ) { |
| 2517 | return elems; // Well, that was easy. |
| 2518 | } |
| 2519 | |
| 2520 | std::stringstream ss( text_in ); |
| 2521 | std::string item; |
| 2522 | while( std::getline( ss, item, delim_in ) ) { |
| 2523 | elems.push_back( item ); |
| 2524 | } |
| 2525 | |
| 2526 | if( text_in.back() == delim_in ) { |
| 2527 | elems.emplace_back( "" ); |
| 2528 | } |
| 2529 | |
| 2530 | return elems; |
| 2531 | } |
| 2532 | |
| 2533 | // find substring (case insensitive) |
| 2534 | int ci_find_substr( const std::string &str1, const std::string &str2, const std::locale &loc ) |