TheBeginner
January 26th, 2003, 07:11 PM
Sorry for stupid question, but...
The problem is as follows. For two given std::strings s1 and s2 I must find all occurences of s2 in s1 and replace them with, say, s3 (C++,STL). Of course, there's a number of different solutions of the problem. But I do want to find solution that can be expressed "in one string", using a combination of some usual STL algorithms, without explicit "find-replace" cycle.
I tried hard but I can't invent it by myself. I remember that I have already seen such a thing somewhere oin the net, but I can't found it in any way. So, I'm just going insane. Help me, please.
The problem is as follows. For two given std::strings s1 and s2 I must find all occurences of s2 in s1 and replace them with, say, s3 (C++,STL). Of course, there's a number of different solutions of the problem. But I do want to find solution that can be expressed "in one string", using a combination of some usual STL algorithms, without explicit "find-replace" cycle.
I tried hard but I can't invent it by myself. I remember that I have already seen such a thing somewhere oin the net, but I can't found it in any way. So, I'm just going insane. Help me, please.