日期:2009-07-05  浏览次数:20639 次

'根据文本文件获得每行字符串的数组

Function GetLineStrByTxtFile(ByVal txtFileName As String) As ArrayList


Dim fs As IO.FileStream = New IO.FileStream(txtFileName, IO.FileMode.Open, IO.FileAccess.Read)

Dim sr As IO.StreamReader = New IO.StreamReader(fs, System.Text.Encoding.GetEncoding("GB2312"))

Dim ArrayStr As Array = sr.ReadToEnd().Split(vbCrLf)

Dim i As Integer : Dim tmList As New ArrayList

For i = 0 To ArrayStr.Length - 1

tmList.Add(ArrayStr.GetValue(i))

Next

fs.Close() : Return tmList

End Function