What kind of developer chooses documentation over development?
JasonLee07
Posts
-
So I gave a dev a choice yesterday -
Streamreader, Stringbuilder, and Stream or StringwriterThanks for the steps and showing the difference between the different classes. Below is what I have so far and I think it will work. My new file contained the 111222333 string for all the missing data which was the desired result. Thanks, Jason StreamReader sr = File.OpenText("C:\\Source.txt"); StreamWriter sw = File.CreateText("C:\\Test1.txt"); while (sr.Peek() != -1) { string strRecord = sr.ReadLine(); string strSurname = strRecord.Substring(0, 10); string strFirstName = strRecord.Substring(11, 8); string strPupilNum = strRecord.Substring(20, 9).Trim(); string strSSID = strRecord.Substring(373, 9).Trim(); if (strPupilNum == String.Empty) { // call db stored procedure to retrieve PupilNum based on SSID StringBuilder sb = new StringBuilder(strRecord); sb.Remove(20, 9); sb.Insert(20, "111222333", 1); strRecord = sb.ToString(); } sw.WriteLine(strRecord); } sw.Close();
-
Is there a way to get a list of all exceptions that can be thrown by a program....Hope I'm not asking a dumb question but is the code you're executing within a try / catch block? Second question is do you what is causing the exception yet?
-
PDF GenerationJust my 2c, I found itextSharp very easy to implement.
-
Streamreader, Stringbuilder, and Stream or StringwriterI have done plenty of googling and have gotten close to a solution but wanted to make sure I'm going about it the right way. I have a data file which is a non delimited fixed field position file that has missing data. I basically want to read each line in and determine if a certain field is blank. If so I use another field in that same record to retrieve the missing data from the database. After getting the missing value I would like to use StreamWriter or StringWriter (not sure which) to write out each line to a new file with the updated field value. Appreciate any advice you all may have on this subject. Thanks, Jason