cc ess.Read) Dim sr" name="description" />

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

发表于:2007-06-30来源:作者:点击数: 标签:
@#根据文本文件获得每行字符串的数组 Function GetLineStrByTxtFile(ByVal txtFileName As String) As ArrayList Dim fs As IO.FileStream = New IO.FileStream(txtFileName, IO.FileMode.Open, IO.FileA clearcase /" target="_blank" >cc ess.Read) Dim sr
@#根据文本文件获得每行字符串的数组

Function GetLineStrByTxtFile(ByVal txtFileName As String) As ArrayList

Dim fs As IO.FileStream = New IO.FileStream(txtFileName, IO.FileMode.Open, IO.FileAclearcase/" target="_blank" >ccess.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


原文转自:http://www.ltesting.net