How to read character in a file 1 by 1 c#

前端 未结 4 519
夕颜
夕颜 2021-01-05 05:34

I want my program to read a text file all characters 1 by 1 and whereever it finds inverted comma ( \" ), it adds a semicolon before that inverted comma. For eg we have a pa

4条回答
  •  礼貌的吻别
    2021-01-05 06:22

    Try ch = (char)reader.Peek();

    This will read tell you the next character without reading it. You can then use this to check if it is a " or not an insert : accordingly

    if (Convert.ToInt32((char)read.Peek()) == 34) Console.Write(@";")
    

提交回复
热议问题