更新时间:2022-11-16 16:46:23
使用 std :: replace 算法:
std :: replace
#include <algorithm> #include <string> #include <iostream> int main() { std::string str = "abccccd"; std::replace(str.begin(), str.end(), 'c', ' '); std::cout << str << std::endl; }
如何在C ++中使用std :: string将一个字符替换为另一个字符?
如何在C ++ / CX中将String ^转换为std :: string
如何在C ++中将unsigned char *转换为std :: string?
如何在 C++ (Unicode) 中将 std::string 转换为 LPCWSTR
如何在 C++ 中将 unsigned char* 转换为 std::string?
如何在Visual Studio C ++ 2010中将BSTR转换为std :: string?
如何使用MinGW在C ++中将int转换为std :: string?
如何在 Visual Studio C++ 2010 中将 BSTR 转换为 std::string?