MCPcopy Create free account
hub / github.com/carbonengine/trinity / StringReplace

Function StringReplace

trinity/Utilities/StringUtils.h:112–122  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Replace substring Similar to Python's replace() --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

110// Similar to Python's replace()
111// --------------------------------------------------------------------------------
112inline 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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected