Hi everyone, I could really use some help. I'm writing a function that is supposed to read in a file and split off chunks of that file to a new file. So basicly whenever the program sees the word <color> it is to write that line out and every line after it until it hits </color>. It should then write the </color> line out then wait until the next instance of the word <color> and then repeat the process.
I hope this makes sense. Here is copy of my latest attemp at coding this. Thank you for your help!
I hope this makes sense. Here is copy of my latest attemp at coding this. Thank you for your help!
Public Function colors(ByVal Inputfile() As String, ByVal count As String) As String Dim match As String Dim aryText(count) As String'// set the counter in the string aryText = Inputfile '// assigning the file to the array that will be written out. Dim FILE_NAME As String = ("C:\test.txt") Dim objWriter As New System.IO.StreamWriter(FILE_NAME) '//set the name of the file to be written out For i = 0 To count - 1 '// loop to scan file Do Until aryText(i).Trim = "</Color>" match = aryText(i) objWriter.WriteLine(aryText(i)) i = i + 1 Loop If aryText(i).Trim = "</Color>" Then match = aryText(i) objWriter.WriteLine(aryText(i)) End If Next Return count End Function
Last edited by a moderator: