I need to search a string and edit the formatting of it.
So far I can replace the first occurrence of the string, but I am unable to do so with the next occurrences
try the following
const std::string s = "*A"; const std::string t = "*A\n"; std::string::size_type n = 0; while ( ( n = chartDataString.find( s, n ) ) != std::string::npos ) { chartDataString.replace( n, s.size(), t ); n += t.size(); }