ĳַһַеһγֵλá

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

start 
ѡֵʽÿĿʼλáʡԣӵһַλÿʼ start  Nullִָ compareҪ start  
string1 
ѡַʽ 
string2 
ѡҪַʽ 
compare 
ѡָʾڼַʱʹõıȽ͵ֵйֵġá֡ʡԣִжƱȽϡ 

compare ֵ

 ֵ  
vbBinaryCompare 0 ִжƱȽϡ 
vbTextCompare 1 ִıȽϡ 

ֵ
InStr ֵ

 InStr  
string1 Ϊ㳤 0 
string1 Ϊ Null Null 
string2 Ϊ㳤 start 
string2 Ϊ Null Null 
string2 ûҵ 0 
 string1 ҵ string2 ҵƥַλ 
start > Len(string2) 0 

˵
ʾ InStr ַ

Dim SearchString, SearchChar, MyPos
SearchString ="XXpXXpXXPXXP"   ' Ҫַ
SearchChar = "P"   ' Search for "P".
MyPos = Instr(4, SearchString, SearchChar, 1)   ' λ 4 еıȽϡ 6
MyPos = Instr(1, SearchString, SearchChar, 0)   ' λ 1 еĶƱȽϡ 9
MyPos = Instr(SearchString, SearchChar)   ' Ĭ£еǶƱȽϣʡĲ 9
MyPos = Instr(1, SearchString, "W")   ' λ 1 еĶƱȽϡ 0Ҳ "W"
ע   InStrB ʹðַеֽݣ InStrB صĲһַһַеһγֵַλãֽλá
Ҫ
汾 1

