| 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 ), |