MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / replaceInPlace

Function replaceInPlace

unittests/catch.hpp:9607–9619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9605 }
9606
9607 bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) {
9608 bool replaced = false;
9609 std::size_t i = str.find( replaceThis );
9610 while( i != std::string::npos ) {
9611 replaced = true;
9612 str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() );
9613 if( i < str.size()-withThis.size() )
9614 i = str.find( replaceThis, i+withThis.size() );
9615 else
9616 i = std::string::npos;
9617 }
9618 return replaced;
9619 }
9620
9621 pluralise::pluralise( std::size_t count, std::string const& label )
9622 : m_count( count ),

Callers

nothing calls this directly

Calls 3

substrMethod · 0.80
findMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected