我有一个制表符分隔的文本文件:
name \t loan period \t loan amount
John \t 5 years \t 6000
Sarah \t 5 years \t 6000
Jane \t 1 month \t 100
我正在寻找将“贷款期”=“5年”的行复制到“贷款期”=“1个月”的行,以进行比较。新行将附加在结果文件的末尾。
我希望达到的最终结果是:
name \t loan period \t loan amount
John \t 5 years \t 6000
Sarah \t 5 years \t 6000
Jane \t 1 month \t 100
John \t 1 month \t 100
Sarah \t 1 month \t 100
我一直在用 Visual Basic .Net 玩弄这个,到目前为止,这就是我想出的
Dim strData As String
Dim i As Short
Dim strLine() As String
lngSize = 0
FileOpen(1, txtloanlistinput.Text, OpenMode.Input)
While Not EOF(1)
i = i + 1
strData = LineInput(1)
End While
FileClose(1)
ReDim loanlist(i)
strData = ""
lngSize = i
i = 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 If
strLine = Split(strData, Chr(9))
loanlist(i).strName = strLine(0)
loanlist(i).strLoanPeriod = strLine(1)
loanlist(i).curLoanAmount = strLine(2)
End While
FileClose(1)
FileClose(2)
我对如何继续画一个空白,并认为我会寻求帮助。