Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<class Type>
- int nStringBase<Type>::replace(std::list<std::pair<nStringBase<Type>,nStringBase<Type> > > &strings)
- {
- int count = 0;
- int curPos = 0;
- bool found = false;
- do
- {
- found = false;
- std::list<std::pair<nStringBase<Type>,nStringBase<Type> > >::iterator iter;
- for(iter = strings.begin(); iter!=strings.end();++iter)
- {
- int temp;
- if((temp = this->indexOf(iter->first,curPos)) != -1)
- {
- curPos = temp;
- *this = this->subString(0,curPos) + iter->second + this->subString(curPos + iter->first.getLength());
- curPos += iter->second.getLength();
- ++count;
- found = true;
- break;
- }
- }
- }
- while(found);
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement