Hello, there is a string
string str="go hi . uyyuer";
How can you find a character in this line, let's say "."
and then copy it?
As a result, to get this:
str="go hi .. uyyuer";
Thank.
Hello, there is a string
string str="go hi . uyyuer";
How can you find a character in this line, let's say "."
and then copy it?
As a result, to get this:
str="go hi .. uyyuer";
Thank.
str.insert (str.find("."), ".");
PS General option:
for (int i = 0; i < str.length()-1; i++) if (str.at(i) == '.') str.insert (i++, ".");
It is possible to try through STL somehow.
Source: https://ru.stackoverflow.com/questions/73988/
All Articles