欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

VBScript InStr 函數(shù)

定義和用法

InStr 函數(shù)可返回一個(gè)字符串在另一個(gè)字符串中首次出現(xiàn)的位置。

InStr 函數(shù)可返回下面的值:

  • 如果 string1 為 ""(零長度) - InStr 返回 0
  • 如果 string1 為 Null - InStr 返回 Null
  • 如果 string2 為 "" - InStr 返回 start
  • 如果 string2 為 Null - InStr 返回 Null
  • 如果 string2 沒有找到 - InStr 返回 0
  • 如果在 string1 中找到 string2,InStr 返回找到匹配字符串的位置。
  • 如果 start > Len(string1) - InStr 返回 0

提示:請參閱 InStrRev 函數(shù)。

語法

InStr([start,]string1,string2[,compare])
參數(shù) 描述
start 可選的。規(guī)定每次搜索的起始位置。默認(rèn)是搜索起始位置是第一個(gè)字符。如果已規(guī)定 compare 參數(shù),則必須有此參數(shù)。
string1 必需的。需要被搜索的字符串。
string2 必需的。需搜索的字符串。
compare

必需的。規(guī)定要使用的字符串比較類型。默認(rèn)是 0 ?刹捎孟铝兄担

  • 0 = vbBinaryCompare - 執(zhí)行二進(jìn)制比較。
  • 1 = vbTextCompare - 執(zhí)行文本比較。

實(shí)例

例子 1

dim txt,pos
txt="This is a beautiful day!"
pos=InStr(txt,"his")
document.write(pos)

輸出:

2

例子 2

dim txt,pos
txt="This is a beautiful day!"
'A textual comparison starting at position 4
pos=InStr(4,txt,"is",1)
document.write(pos)

輸出:

6

例子 3

dim txt,pos
txt="This is a beautiful day!"
'A binary comparison starting at position 1
pos=InStr(1,txt,"B",0)
document.write(pos)

輸出:

0