DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C# (http://www.daniweb.com/forums/forum61.html)
-   -   Simpel string sorting (http://www.daniweb.com/forums/thread161769.html)

Schokbreker Dec 11th, 2008 6:35 am
Simpel string sorting
 
Hi All,

After reading a long time on Daniweb, it's my time to ask you guys something.
I am combining textfiles with a foreach loop. At this point it's working correctly with the following code:
            foreach (string readfile in openFileDialog1.FileNames)
            {
                string completepath = Path.GetFullPath(readfile);
                StreamReader sr = new StreamReader(completepath, Encoding.Default, true, 1024);
                StringBuilder filetosave = new StringBuilder();
                string text = sr.ReadToEnd();
                filetosave.Append(text);
                string finalfile = filetosave.ToString();
                File.AppendAllText(saveto + "\\combined.txt", finalfile.ToUpper(), Encoding.Default);
                sr.Close();
                sr.Dispose();

            }

Is there a simple way to sort the final string (before saving) on a particular position in the line? All lines have the same character count, and I want to save the file sorted on position 138 (7 characters).

Thanks in advance,

Schokbreker

LizR Dec 11th, 2008 7:56 am
Re: Simpel string sorting
 
Please search this forum - this question has been asked and answered before.


All times are GMT -4. The time now is 6:29 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC