开发者

Regex question in C#

how to remove only one char (") if there two("") from the string in C# (Regex )

ex.:

123"43""343"54"" ==>  123"43"343"54"

"abc""def"gh"开发者_JS百科"i  ==>  "abc"def"gh"i

thank's in advance


You don't need regex for this. Just search for the sub-string "" and replace it with "


someString.Replace(@"""""",@""""); should work, shouldn't it?

while (someString.IndexOf(@"""""") > -1)
{
   someString = someString.Replace(@"""""",@"""");
}


Regex regExp = new Regex("\"\"");
string test = "123\"\"123\"\"123";
string tempTxt = regExp.Replace(test, "\"");

Something like this? But yeah, i think Regex isn't good choise here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜