Boost logo

Boost Users :

From: Valentine Rozental (valentine.rozental_at_[hidden])
Date: 2008-06-04 12:00:19


Dear All,

what is the elegant/right way to insert some substr into the given str?
For example:

// -------------------------------------------------------
...
std::string str("xyz_123_abc_xyyz_a1b");
std::string mark("abc");
std::string substr("$$$");

iterator_range<range_iterator<std::string>::type>
        it1 = boost::find_first(str, mark);
...
// -------------------------------------------------------

I want to insert substr ("$$$") after mark ("abc") if the mark exists
in the str.
That is, the result in the example above should be: "xyz_123_abc$$$_xyyz_a1b"

Thank you in advance!


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net