int string_replase(string &s1, const string &s2, const string &s3)
{
string::size_type pos = 0;
string::size_type a = s2.size();
string::size_type b = s3.size();
while ((pos = s1.find(s2,pos)) != string::npos)
{
s1.replace(pos, a, s3);
pos += b;
}
return 0;
}
string s2 = "###ip##";
string s1 = "http://123###ip##678.com";
string s3 = "192";
string_replase(s1, s2, s3);