如何在字符串(char数组)中查找元素并将其加倍?
答
只要使用字符串::查找和字符串::插入。
const char *c_str = "123>45";
std::string a = std::string(c_str);
std::string b = ">";
a.insert(a.find(b), b);
c_str = a.c_str();