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 283 views
283 views asked Mar 12, 2015 by avibootz
1 answer 292 views
1 answer 271 views
1 answer 246 views
246 views asked Mar 11, 2017 by avibootz
2 answers 405 views
1 answer 319 views
...