VBScript InStr ফাংশন

অর্থ ও ব্যবহার

InStr ফাংশন ফিরস্ট একটি স্ট্রিং-এর অন্য স্ট্রিং-এর প্রথম উপস্থিতি-এর স্থান

InStr ফাংশন ফিরস্ট নিচের মান

  • যদি string1 "" (শূন্য দৈর্ঘ্য) - InStr ফিরস্ট 0
  • যদি string1 Null - InStr ফিরস্ট Null
  • যদি string2 "" - InStr ফিরস্ট start
  • যদি string2 Null - InStr ফিরস্ট Null
  • যদি string2 পাওয়া যায় না - InStr ফিরস্ট 0
  • যদি string1-তে string2 পাওয়া যায়, InStr পাওয়া হয় মিলিত স্ট্রিং-এর স্থান
  • যদি start > Len(string1) - InStr তবে InStr ফিরস্ট 0

টীকা:দেখুন InStrRev ফাংশন

গঠন

InStr([start,]string1,string2[,compare])
Parameter Description
start Optional.Specify the starting position of each search. The default is the first character of the search. If the compare parameter is specified, then this parameter must be present.
string1 আবশ্যকীয়।The string to be searched for.
string2 আবশ্যকীয়।The string to be searched.
compare

আবশ্যকীয়।Specify the type of string comparison to be used. The default is 0. The following values can be used:

  • 0 = vbBinaryCompare - Execute binary comparison.
  • 1 = vbTextCompare - Execute text comparison.

ইনস্ট্যান্স

উদাহরণ 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