Strip double quotes from a string in .NET

后端 未结 12 2231
抹茶落季
抹茶落季 2020-12-24 04:16

I\'m trying to match on some inconsistently formatted HTML and need to strip out some double quotes.

Current:


         


        
12条回答
  •  庸人自扰
    2020-12-24 05:03

    I didn't see my thoughts repeated already, so I will suggest that you look at string.Trim in the Microsoft documentation for C# you can add a character to be trimmed instead of simply trimming empty spaces:

    string withQuotes = "\"hellow\"";
    string withOutQotes = withQuotes.Trim('"');
    

    should result in withOutQuotes being "hello" instead of ""hello""

提交回复
热议问题