Public Class Func
Public Shared Sub Main() '测试代码!
Dim Temp As String()() = Func.GetArrayByTxt("D:\Test.txt")
End Sub
Public Shared Function GetArrayByTxt(path As String) As String()()
Dim arr As String() = IO.File.ReadAllLines(path, Encoding.Default)
Dim par As Char() = {",", "."}
Dim result(arr.Length - 1)() As String
For i As Integer = 0 To arr.Length - 1
result(i) = arr(i).Split(par)
Next
Return result
End Function
End Class
追问请问怎么使用呢?
追答GetArrayByTxt("C:\1.txt") 这个函数输出的就是{{"array","啊"},{"array","啊啊"},{"啊","array"}}这个结果!
也就是Dim array As String()() = GetArrayByTxt("C:\1.txt")