find_end

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#include <iostream>
#include <algorithm>
#include <string>
int main() {
std::string str("1001101010");
const char* match = "1";
std::string::iterator it;
it = std::find_end(str.begin(), str.end(), match, match+1);
*it = '0';
std::cout<<str<<std::endl;
return 0;
}