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

前端 未结 4 543
夕颜
夕颜 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:25

    Swap the order of the operations:

        if (Convert.ToInt32(ch) == 34)
        {
            Console.Write(@";");
        }
        Console.Write(ch);
    

    e.g. don't write the original character until AFTER you've decided to output a semicolon or not.

提交回复
热议问题