Simpel string sorting

Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Dec 2008
Posts: 2
Reputation: Schokbreker is an unknown quantity at this point 
Solved Threads: 0
Schokbreker Schokbreker is offline Offline
Newbie Poster

Simpel string sorting

 
0
  #1
Dec 11th, 2008
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:
  1. foreach (string readfile in openFileDialog1.FileNames)
  2. {
  3. string completepath = Path.GetFullPath(readfile);
  4. StreamReader sr = new StreamReader(completepath, Encoding.Default, true, 1024);
  5. StringBuilder filetosave = new StringBuilder();
  6. string text = sr.ReadToEnd();
  7. filetosave.Append(text);
  8. string finalfile = filetosave.ToString();
  9. File.AppendAllText(saveto + "\\combined.txt", finalfile.ToUpper(), Encoding.Default);
  10. sr.Close();
  11. sr.Dispose();
  12.  
  13. }

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
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Simpel string sorting

 
0
  #2
Dec 11th, 2008
Please search this forum - this question has been asked and answered before.
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC