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

Please search this forum - this question has been asked and answered before.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.