简体   繁体   English

从字符串中删除转义符“ \\”

[英]Remove escape character “\” from string

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

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

Regex Unescape will remove all escaping characters from a string, here is a link to this information: Regex Unescape将从字符串中删除所有转义字符,这是此信息的链接:

http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.unescape.aspx http://msdn.microsoft.com/zh-CN/library/system.text.regularexpressions.regex.unescape.aspx

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM