-------------------------------------------------------------------------------- Description: Replace substring Similar to Python's replace() --------------------------------------------------------------------------------
| 110 | // Similar to Python's replace() |
| 111 | // -------------------------------------------------------------------------------- |
| 112 | inline bool StringReplace( std::string& baseString, const char* oldString, const char* newString ) |
| 113 | { |
| 114 | // find what to replace |
| 115 | size_t replaceStart = baseString.find( oldString ); |
| 116 | if( replaceStart != std::string::npos ) |
| 117 | { |
| 118 | baseString.replace( replaceStart, strlen( oldString ), std::string( newString ) ); |
| 119 | return true; |
| 120 | } |
| 121 | return false; |
| 122 | } |
| 123 | |
| 124 | |
| 125 |
no outgoing calls
no test coverage detected