如何使用双黑斜杠从字符串中删除单反斜杠

How to remove single backslash from string with double blackslashes

本文关键字:字符串 删除 单反斜 何使用      更新时间:2023-10-16

假设我有一个字符串:

std::string x = "\asdasd\sewef\sdvrhe\"

如何删除双背拉,使字符串仅包含单背?

我需要 x 字符串的值为:

asdasdsewefsdvrhe

我愿意更换字符或删除任何达到预期结果的方法将被接受。

"boost string algo" 是你的朋友:

boost::replace_all(x, "\\", "\");