I have file in this format:
No,Name,Sal,Location,ID
1,George,"£7,634",GBR,121
2,Mike,"£7,435",RUS,122
3,Bell,£835,ARG,123
My output file should be like this:
Name,Sal,ID
George,"7,634",121
Mike,"7,435",122
Bell,835,123
I want to take off the £ sign from sal column values. I coded like this:
Dim ioReader As New System.IO.Streamreader("C:\old.csv")
ioLines="Name,Sal,ID"
Dim ioWriter As New System.IO.StreamWriter("C:\new.csv")
While Not ioLine = ""
ioLine = ioFile.ReadLine
Dim values As String()
If ioLine <> "" Then
values = ioLine.Split(",")
Dim outPut as string=values(1) & values(2).substring(2,length(values(2)-1) & values(4)
ioLines += System.Environment.NewLine & outPut
EndIf
EndWhile
ioWriter.WriteLine(ioLines)
But I am not getting the right answer. I am getting values as
George,7,634 --- Wrong
Mike,7,435 --- Wrong
Bell,835,123 --- Correct
Any Suggestions please?