以下是引用slore在2007-9-11 17:49:10的发言:
没有测试效率,只是提供个另外的思路……
代码长度……
Private Function fncGetStrNum(InString As String, InSearch As String, InCount As Integer) As Long
Dim TempStr As String
TempStr = Replace(InString, InSearch, "", 1, InCount - 1)
fncGetStrNum = InStr(TempStr, InSearch)
If fncGetStrNum <> 0 Then fncGetStrNum = fncGetStrNum + (InCount - 1) * Len(InSearch)
End Function
没有测试效率,只是提供个另外的思路……
代码长度……
Private Function fncGetStrNum(InString As String, InSearch As String, InCount As Integer) As Long
Dim TempStr As String
TempStr = Replace(InString, InSearch, "", 1, InCount - 1)
fncGetStrNum = InStr(TempStr, InSearch)
If fncGetStrNum <> 0 Then fncGetStrNum = fncGetStrNum + (InCount - 1) * Len(InSearch)
End Function
这个思路好,赞
以下是引用mohan123在2007-9-11 14:58:19的发言:
谢谢,但是我不明白“If Len(srchString) = 0 Then InStrL = -1: Exit Function”
为什么要赋值为-1。
随便的,一个Tag。你应当避免这种情况出现