Well, who I was meaning to refer to regarding readALLLines method-was the poster that offered up the ReadALlLines method of the File class. - Still, you offered a great help explaining why OP code was failing. That was a good response. :)
proneal
Posts
-
Reading the contents of a file into an array -
Reading the contents of a file into an arrayYes, I am sorry -it looks like I replied under wrong heading. My post is intended for OP, and not you in any way. Y_our resolution is what I would have done too, btw_ ;) .Thanks for letting me clear this up. :) have a Great Day Luc!
-
Reading the contents of a file into an arrayDim stocksymbolarrayLong() As String
Dim filecount As Integer
'Count the lines in the file you are reviewing.Dim LongFile As System.IO.StreamReader
LongFile = System.IO.File.OpenText("C:\Users\George Desktop\Documents\Stock System\Stock Programs\Stock Program Data\LongStockTesting.txt")filecount = 0
Do Until LongFile.Peek = -1
LongFile.ReadLine()
ReDim Preserve stocksymbolarrayLong(filecount)
stocksymbolarrayLong(filecount) = LongFile.ReadLine
filecount = filecount + 1
LoopLongFile.Close()
' Sort the array's
If Not stocksymbolarrayLong Is Nothing Then
Array.Sort(stocksymbolarrayLong)
End IfI did a little reworking USING your method of getting the values. There is better one, readALlLines from the IO.File class, but I used ur code. This should work , but I can't test it. Good luck!
-
Regular Expressions: dealing with a quoteI would use RegEx, but this is a dirty way to do it:
Dim strUnitsResolved As String = String.Empty
Dim strUnits As String = "point_units=""'meters'"">"""
strUnits = Replace(strUnits, "point_units=""'", "")strUnitsResolved = Replace(strUnits, "'"">""", String.Empty) MsgBox(strUnitsResolved)