MCPcopy Create free account
hub / github.com/Aloshi/EmulationStation / splitString

Method splitString

src/components/ThemeComponent.cpp:363–376  ·  view source on GitHub ↗

splits a string in two at the first instance of the delimiter

Source from the content-addressed store, hash-verified

361
362//splits a string in two at the first instance of the delimiter
363void ThemeComponent::splitString(std::string str, char delim, std::string* before, std::string* after)
364{
365 if(str.empty())
366 return;
367
368 size_t split = str.find(delim);
369 if(split != std::string::npos)
370 {
371 *before = str.substr(0, split);
372 *after = str.substr(split + 1, str.length() - split - 1);
373 }else{
374 LOG(LogError) << "Tried to splt string \"" << str << "\" with delimiter '" << delim << "', but delimiter was not found!";
375 }
376}
377
378//converts a string to a float
379float ThemeComponent::strToFloat(std::string str, float defaultVal)

Callers

nothing calls this directly

Calls 2

findMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected