![]() |
#2
风吹过b2017-02-03 17:53
|

Public Function rFind(ByVal txt As String, ByVal code1 As String, Optional ByVal code2 As String = """", Optional ByVal rev As Boolean = False)
On Error Resume Next
Dim tmp As String, i1 As Long, i2 As Long
tmp = txt
If InStr(tmp, code1) = 0 Then rFind = "": Exit Function
i1 = InStr(tmp, code1) + Len(code1)
tmp = Mid(tmp, i1)
If InStr(tmp, code2) = 0 Then rFind = "": Exit Function
If rev Then
i2 = InStrRev(tmp, code2)
Else
i2 = InStr(tmp, code2)
End If
rFind = Mid(tmp, 1, i2 - 1)
End Function
On Error Resume Next
Dim tmp As String, i1 As Long, i2 As Long
tmp = txt
If InStr(tmp, code1) = 0 Then rFind = "": Exit Function
i1 = InStr(tmp, code1) + Len(code1)
tmp = Mid(tmp, i1)
If InStr(tmp, code2) = 0 Then rFind = "": Exit Function
If rev Then
i2 = InStrRev(tmp, code2)
Else
i2 = InStr(tmp, code2)
End If
rFind = Mid(tmp, 1, i2 - 1)
End Function
特别是其中I1,I2,TMP,COD1,COD2,及最后的RFIND都是什么意思[color=#0000FF][/color]
[此贴子已经被作者于2017-2-3 17:18编辑过]