0

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

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by LizR
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.