MCPcopy Create free account
hub / github.com/CleverRaven/Cataclysm-DDA / string_split

Function string_split

src/output.cpp:2512–2531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2510}
2511
2512std::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)
2534int ci_find_substr( const std::string &str1, const std::string &str2, const std::locale &loc )

Callers 11

wildcard_matchFunction · 0.85
ensure_loadedMethod · 0.85
teleport_overmapFunction · 0.85
check_special_ruleFunction · 0.85
get_varMethod · 0.85
debug_resolve_binaryFunction · 0.85
gettext_genderedFunction · 0.85
special_wave_messageMethod · 0.85
check_memorialFunction · 0.85
extract_mod_selectionFunction · 0.85
check_sun_plotFunction · 0.85

Calls 3

emptyMethod · 0.45
push_backMethod · 0.45
backMethod · 0.45

Tested by 3

check_memorialFunction · 0.68
extract_mod_selectionFunction · 0.68
check_sun_plotFunction · 0.68