vb 读文本 子函数

来源:百度知道 编辑:UC知道 时间:2024/06/16 14:30:51
以下是读一个文本的子函数,请问高手这是什么意思
Sub GetFile(GetStr As String, FullStr As String, GetStrAl As String)
Dim Inte, InTem(1 To 2) As Integer
'Dim GetStrAl As String

Inte = InStr(Inte + 1, FullStr, GetStr)
InTem(1) = Inte
Inte = InStr(Inte + 1, FullStr, GetStr)
InTem(2) = Inte

GetStrAl = Mid(FullStr, InTem(1) + Len(GetStr), InTem(2) - InTem(1) - Len(GetStr))

End Sub
Inte = InStr(Inte + 1, FullStr, GetStr)中的inte+1是什么意思,有什么用,可不可以把inte+1改成其它的数字,如Inte = InStr(2, FullStr, GetStr)

Sub GetFile(GetStr As String, FullStr As String, GetStrAl As String)
Dim Inte, InTem(1 To 2) As Integer
'Dim GetStrAl As String

Inte = InStr(Inte + 1, FullStr, GetStr) 获得第一个GetStr的在FullStr中位置
InTem(1) = Inte
Inte = InStr(Inte + 1, FullStr, GetStr) 获得第二个GetStr的在FullStr中位置
InTem(2) = Inte

GetStrAl = Mid(FullStr, InTem(1) + Len(GetStr), InTem(2) - InTem(1) - Len(GetStr)) 获取两个 getstr 中间的内容

End Sub

InStr 返回被搜索的字符 在另以字符串里的位置
加上len mid你都知道意思。你逐条语句理解就是了。很简单。