Skip to main content
 首页 » 编程设计

c#之从字符串中删除转义字符 "\"

2024年02月13日19落叶

我需要从 imagepth 字符串变量中删除 \ 字符:

imagepth = "# Eval(\"Name\",\"Gallary/\"" + imgwords[4] + "\"/Images/{0}\")"; 

请您参考如下方法:

您可以使用 Replace 方法将 "\\" 替换为空字符串

   str = str.Replace("\\", "");