如何指定"字符 [英] How to specify the " character

查看:142
本文介绍了如何指定"字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用string.Remove删除所有的在我的HTML,但我忘了如何告诉它使用作为一个字符,而不是其通常的意义。

I am trying to use string.Remove to remove all occurrences of " in my html, but I forgot how to tell it to use " as a character instead of its usual meaning.

感谢。

推荐答案

您有 \ ,所以写 \而不是其中,你的意思是

You have to escape it with \, so write \" instead of " where you mean ".

string.Remove删除字符串的一部分的基础上开始索引和长度,所以这是不是你实际上是寻找,但更换将帮助您摆脱所有的

string.Remove removed part of the string based on start index, and length, so that is not what you are actually looking for, but replace will help you to get rid of all "'s.

myString.Replace("\"","")

这篇关于如何指定"字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆