How to Trim() lines from a text file in C#

1 Answer

0 votes
using System;
using System.IO;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            foreach (string line in File.ReadAllLines("d:\\data.txt"))
            {
                string s = line.Trim();
                Console.WriteLine(s);
            }
        }
    }
}

/*
run:

java c c++ c# php
javascript
python

*/

 



answered Jan 20, 2017 by avibootz

Related questions

1 answer 177 views
177 views asked Mar 12, 2015 by avibootz
1 answer 192 views
1 answer 174 views
1 answer 155 views
155 views asked Mar 11, 2017 by avibootz
2 answers 267 views
1 answer 215 views
...