|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Imports System.IO
Imports System.Text
Public Class Text
Shared Function Read(ByVal Path As String) As String()
Dim sr As New StreamReader(Path, Encoding.GetEncoding("GB2312"))
Dim list As New List(Of String), s As String
Do While Not sr.EndOfStream
s = sr.ReadLine
If 判断条件 Then list.Add(s)
Loop
sr.Dispose() : sr.Close()
Return list.ToArray
End Function
Shared Sub Write(ByVal Path As String, ByVal s As String)
Dim sw As New StreamWriter(Path, False, Encoding.GetEncoding("GB2312"))
sw.Write(s) : sw.Flush() : sw.Close()
End Sub
End Class |
|