Chr (34) equivalent

I convert the code VB.NETto c#, and I stop when I reach the next piece of code. I need someone to help convert Chr (34). Please help me convert it to c#.

VB.NET Code

Dim inputString As String
inputString = "Some text ..."
inputString = Replace(inputString, Chr(34), "")**

My c # conversion

string inputString = "Some text ...";
inputString = inputString.Replace(NEED HELP HERE, "");**
+6
source share
2 answers

You can distinguish an integer before char, so the "automatic" translation will be as follows:

inputString = inputString.Replace(, ((char) 34).ToString(), "")

In this case, the characters that are mapped to 34 (according to ASCII) ", so you can just build a double-quoted string char:

inputString = inputString.Replace(, "\"", "")

It will also improve readability, as it is now clear what you are doing in this part: you are removing double quotes.

+17

:

string inputString = null;
inputString = "Some text ...";
inputString = Strings.Replace(inputString, Strings.Chr(34), "");

, . - .

, .

+4

All Articles