vb.net - copying from a tab delimited text file to itself -


I have a tab delimited text file:

  name \ t loan duration \ t The loan amount John \ t 5 years \ t 6000 all \ t 5 years \ t 6000 Jane \ t 1 month \ t 100  

I am looking to copy those lines where " New lines will be attached at the end of the file as a result for showing the comparison of "loan duration" = "5 years", where "loan duration" = "one month".

The last result to get the final result is:

  name \ t loan duration \ t loan amount John \ t 5 years \ t 6000 all \ t 5 years \ t 6000 Jane \ t 1 month \ t 100 John \ t 1 month \ t 100 all \ t 1 month \ t 100  

I have about it Visual Basic.Net, and so far, this What have I come up with

is slow strData string as slow as I strings as short dim strLine () string lngSize = 0 FileOpen (1, txtloanlistinput.Text, OpenMode. Input) while not EOF (1) i = i + 1 = strData LineInput (1) termination while FileClose (1) ReDim loanlis T (i) strData = "" lngSize = ii = 0 FileOpen (2, txtloanlistinput.Text, OpenMode. Input) While not EOF (2) i = i + 1 = strData LineInput (2) If I = 1 then strData = LineInput (2) End then strLine = Split (strData, Chr (9)) loanlist (i) .strName = Strokeline (0) Lonelist (I) .strLoanPeriod = strLine (1) loanlist (i) .curLoanAmount = strLine (2 ) End while FileClose (1) FileClose (2)

I am drawing as an empty to how to proceed, and thought that I would ask for help.

is a little ugly but the beginning

// c #

  OpenFile dialog dialog = new OpenFileDialog (); Dialog.ShowDialog (); String filePath = dialog.FileName; // In this list, we store a 5-year match. & Lt; String []> Five Years = New List & lt; String []> (); // open a reader streamrider tr = new streamrider (file path); // 1 degree line reaing string line = tr.ReadLine (); While (Line! = Null & Line! = "" & Amp; Line! = "\ N") {// Divide the line by tab, String [] lineByTabs = line.Split ('\ t'); // If the second term is equivalent to '5 years' (LineBitib [1] .Equals ("5 years")) {// change from 5 years to 1 month, and one hundred of 100 Linebytab [1] = "1 month"; Linebiteab [2] = "100"; FiveYears.Add (lineByTabs); } Line = tr.ReadLine (); } // Close reader tr.Close (); // Open the file and open the lines TextWriter tw = new streamer (file path, true); Fifth (string [] rows in five years) {tw.WriteLine (line [0] + "\ t" + line [1] + "\ t" + line [2]); } Tw.close (); }> Vb.net  
  Smooth dialogue OpenFileDialog = New OpenFileDialog dim filePath, line string is listed as string fiveYears (string of) As in the = new list (string of ()) Dim lineByTabs string () Dim TR StreamReader dim tw TextWriter dialog.ShowDialog () filePath = dialog.FileName TR = New StreamReader (filepath) line = tr.ReadLine () While this is not the case as in line = linebiteb = line. Split (vbTab) if linebytab (1). Acquires ("5 years") then LineBitab (1) = "1 month" LineByTab (2) = "100" Five Years Add (linebytabs) end if line = Tr.ReadLine () end while tr.Close () tw = New StreamWriter (filePath, True) string in the form of each row tw.writeLine (lines (0) + vbTab + Lines (1) + vbTab + line (2)) next two times. ()  

Hope this helps

Note: Flies must be eliminated in a new line and given format To (3 colums) folows


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -