splits a string in two at the first instance of the delimiter
| 361 | |
| 362 | //splits a string in two at the first instance of the delimiter |
| 363 | void 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 |
| 379 | float ThemeComponent::strToFloat(std::string str, float defaultVal) |