MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/TriangleMeshDistance / replaceInPlace

Function replaceInPlace

tests/catch.hpp:11143–11155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11141 }
11142
11143 bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) {
11144 bool replaced = false;
11145 std::size_t i = str.find( replaceThis );
11146 while( i != std::string::npos ) {
11147 replaced = true;
11148 str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() );
11149 if( i < str.size()-withThis.size() )
11150 i = str.find( replaceThis, i+withThis.size() );
11151 else
11152 i = std::string::npos;
11153 }
11154 return replaced;
11155 }
11156
11157 pluralise::pluralise( std::size_t count, std::string const& label )
11158 : m_count( count ),

Callers

nothing calls this directly

Calls 3

findMethod · 0.80
substrMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected