雷火电竞-中国电竞赛事及体育赛事平台

歡迎來到入門教程網(wǎng)!

vb

當(dāng)前位置:主頁 > 軟件編程 > vb >

VBS教程:函數(shù)-InStrRev 函數(shù)

來源:本站原創(chuàng)|時間:2020-01-10|欄目:vb|點擊:

InStrRev 函數(shù)

返回某字符串在另一個字符串中出現(xiàn)的從結(jié)尾計起的位置。

InStrRev(string1, string2[, start[, compare]])

參數(shù)

string1

必選項。接受搜索的字符串表達式。

string2

必選項。被搜索的字符串表達式。

Start

可選項。數(shù)值表達式,用于設(shè)置每次搜索的開始位置。如果省略,則默認值為 -1,表示從最后一個字符的位置開始搜索。如果 start 包含 Null,則出現(xiàn)錯誤

compare

可選項。在計算子字符串時,指示要使用的比較類型的數(shù)值。如果省略,將執(zhí)行二進制比較。有關(guān)數(shù)值,請參閱“設(shè)置”部分。

設(shè)置

compare 參數(shù)可以有以下值:

常數(shù)Value描述
vbBinaryCompare0執(zhí)行二進制比較。
vbDatabaseCompare2執(zhí)行基于包含在數(shù)據(jù)庫(在此數(shù)據(jù)庫中執(zhí)行比較)中的信息的比較。

返回值

InStrRev 返回以下值:

如果InStrRev 返回
string1 為零長度0
string1 為 NullNull
string2 為零長度start
string2 為 NullNull
string2 沒有找到0
在 string1 中找到 string2找到匹配字符串的位置
start > Len(string2)0

說明

下面的示例利用 InStrRev 函數(shù)搜索字符串:

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 函數(shù)的語法與 InStr 函數(shù)的語法并不一樣。

上一篇:VBS教程:VBScript 基礎(chǔ)-VBScript 運算符

欄    目:vb

下一篇:VBS教程:VBScript 與窗體

本文標題:VBS教程:函數(shù)-InStrRev 函數(shù)

本文地址:http://www.jygsgssxh.com/a1/vb/8045.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時內(nèi)進行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有