头文件

#include <algorithm>

例子

下面的代码, 将字符串中的 /替换为\

std::string str("C:/demo/log/head/send");	
std::replace(str.begin(), str.end(), '/', '\\');

输出

C语言之字符串替换库函数replace

相关文章:

  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
  • 2022-12-23
  • 2021-05-18
猜你喜欢
  • 2022-12-23
  • 2022-02-24
  • 2022-12-23
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案