常數 | Value | 描述 |
---|---|---|
vbBinaryCompare | 0 | 執行二進制比較。 |
vbDatabaseCompare | 2 | 執行基于包含在數據庫(在此數據庫中執行比較)中的信息的比較。 |
InStrRev 返回以下值:
如果 | InStrRev 返回 |
---|---|
string1 為零長度 | 0 |
string1 為 Null | Null |
string2 為零長度 | start |
string2 為 Null | Null |
string2 沒有找到 | 0 |
在 string1 中找到 string2 | 找到匹配字符串的位置 |
start > Len(string2) | 0 |
下面的示例利用 InStrRev 函數搜索字符串:
Dim SearchString, SearchChar, MyPosSearchString ="XXpXXpXXPXXP" ' String to search in.SearchChar = "P" ' Search for "P".MyPos = InstrRev(SearchString, SearchChar, 10, 0)
' A binary comparison starting at position 10. Returns 9.
MyPos = InstrRev(SearchString, SearchChar, -1, 1)
' A textual comparison starting at the last position. Returns 12.
MyPos = InstrRev(SearchString, SearchChar, 8)
' Comparison is binary by default (last argument is omitted). Returns 0.
注意 InStrRev 函數的語法與 InStr 函數的語法并不一樣。