2010-05-25 3 views
-1

다음과 같은 종류의 데이터가 포함 된 텍스트 파일이 하나 있습니다.각 줄 끝의 텍스트 파일에 내용을 쓰는 방법

"3P","Smith","Richard","3 Point Promotions","3P","[email protected]","IDA","Yes",,,,0,4,5,83.33,10, 
"A1","Ernest","Amy","TAKE 1 Promotional Products","LCOOK","[email protected]","IDA","Yes",,,,0,6,7,,0, 
"A2","Derek","Eaton","Advertising Edge Promotions","AE","[email protected]","IDA","Yes",,,,0,8,8,,10, 
"AAA","Abercrombie","Jerry","AAA Specialty Wholesale Inc","AAA","[email protected]","IDA","Yes",,,,0,9,9,,10, 
"AAP","Halberstam","Mendy","All About Promotions","AAP","[email protected]","IDA","Yes",,,,0,10,10,,12, 

그들 각각은 별도의 line.Now 있습니다 나는 방법도 동일한 텍스트에 다른 값을 작성 될 선으로 줄에서 내용을 읽을 방법이

"3P","Smith","Richard","3 Point Promotions","3P","[email protected]","IDA","Yes",,,,0,4,5,83.33,10,**96** 
"A1","Ernest","Amy","TAKE 1 Promotional Products","LCOOK","[email protected]","IDA","Yes",,,,0,6,7,,0,**97** 
"A2","Derek","Eaton","Advertising Edge Promotions","AE","[email protected]","IDA","Yes",,,,0,8,8,,10,**98** 
"AAA","Abercrombie","Jerry","AAA Specialty Wholesale Inc","AAA","[email protected]","IDA","Yes",,,,0,9,9,,10,**99** 
"AAP","Halberstam","Mendy","All About Promotions","AAP","[email protected]","IDA","Yes",,,,0,10,10,,12,**100** 

처럼 각각 다른 열을 추가하려면 이 문제에 대한 해결책을 보내주십시오. 회신을 기다리고 있습니다. 답장을 보내 주셔서 감사합니다. -Saravanan

답변

1
이 같은

아마 뭔가 :

Dim lines() As String 
Using reader As New IO.StreamReader(filePath) 
    Dim sep() As String = {vbNewLine} 
    lines = reader.ReadToEnd().Split(sep, StringSplitOptions.RemoveEmptyEntries) 
End Using 
Dim Index as Int32 = 1 
Using writer As New IO.StreamWriter(filePath, False) 
    For Each line As String In lines 
      writer.WriteLine(line & "," & Index.ToString()) 
    Next 
End Using 
관련 문제