编程语言

img iwebsms

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

发表于2004/9/28 19:19:00  812人阅读

 

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

    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

阅读全文
0 0

相关文章推荐

img
取 消
img