I’m struggling on some coding and was hoping someone could help me out please, what I’m trying to do is read a text file and convert column2 in to lowercase and save it again.
But I get Value of type ‘Integer’ cannot be converted to ‘System.Globalization.CultureInfo’. after .ToLower?
Dim Convertcolumn = From line In System.IO.File.ReadLines("Path")
Select line.Split(" "c)(1) & line.ToLower(1)
Dim writer As IO.StreamWriter = New IO.StreamWriter("Path2")
For Each line In Convertcolumn
writer.Write((line) & Environment.NewLine)
Next
Updated coding:
Dim Convertcolumn = From line In System.IO.File.ReadLines("C:\Test1.txt")
Select line.Split(" "c)(1) & line.Split(" "c)(1).ToLower()
Dim writer As IO.StreamWriter = New IO.StreamWriter("C:\Test2.txt")
For Each line In Convertcolumn
writer.Write((line) & Environment.NewLine)
Next
Sorry when i added the comments its not showing as columns the data looks like this
D00001 BLACK user
D00002 BLACK user
and i want to change it to
D00001 black user
D00002 black user
Your original code can’t work when the file contains columns. You’ll need: