Есть в котором встречаются <i>
и </i>
. Заменить каждое вхождение <i>
на <курсив>
, а каждое вхождение </i>
на <конец курсив>
. Помогите такое реализовать.
Вариант решения
#include <iostream>
#include <algorithm>
std::string StringReplacer(const std::string& inputStr, const std::string& src, const std::string& dst)
{
std::string result(inputStr);
size_t pos = result.find(src);
while(pos != std::string::npos) {
result.replace(pos, src.size(), dst);
pos = result.find(src, pos);
}
return result;
}
int main(int argc, char **argv)
{
std::string str = "<i>asd</i><i>qwe</i>";
std::string res = StringReplacer(str, "<i>", "<italic>");
std::string res2 = StringReplacer(res, "</i>", "<end italic>");
std::cout << "Result string: " << res2 << std::endl;
return 0;
}
Программа запрашивает у пользователя шестизначное числоВывести на экран, соблюдал ли он правила
(index):22 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experienceFor more help, check https://xhr