Chr(34) equivalent

后端 未结 2 1001
抹茶落季
抹茶落季 2021-01-11 17:13

I am converting VB.NET code to c# and I am stopped when I reached the following code snippet. I need someone\'s help to convert Chr(34). Please hel

2条回答
  •  时光说笑
    2021-01-11 17:40

    You can cast an integer to a char, so an "automatic" translation would be:

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

    That being said, the characters that maps to 34 (according to ASCII) is ", so you can simply construct a string with the double quote char:

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

    This will also improve readability, since it is now clear what you are doing in that part: you remove double quotation characters.

提交回复
热议问题