VBScript InStrRev کیوینکشن

تعریف اور استعمال

InStrRev کیوینکشن کو دروازت کرسکتا ہے کہ ایک سطر دوسرے سطر میں پہلی بار کتنا موقع آتا ہے۔ تلاش سطر کے آخری حصے سے شروع ہوتی ہے، لیکن دروازت کئے جانے والا موقع سطر کے آغاز سے شمار کیا جاتا ہے۔

InStrRev کیوینکشن کو دروازت کرسکتا ہے:

  • اگر 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 دروازت

تذکر:بھل سکھو InStr کیوینکشن

Syntax

InStrRev(string1,string2[,start[,compare]])
Parameter Description
start Optional. Specifies the starting position for each search. The default is the first character of the search. If the compare parameter is specified, this parameter must also be specified.
string1 Required. The string to be searched.
string2 Required. The string to search for.
compare

Required. Specifies the type of string comparison to use. 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=InStrRev(txt,"his")
document.write(pos)

ਆਉਟਪੁਟ:

2

ਉਦਾਹਰਣ 2

dim txt,pos
txt="This is a beautiful day!"
'textual comparison'
pos=InStrRev(txt,"B",-1,1)
document.write(pos)

ਆਉਟਪੁਟ:

11

ਉਦਾਹਰਣ 3

dim txt,pos
txt="This is a beautiful day!"
'binary comparison'
pos=InStrRev(txt,"T")
document.write(pos)

ਆਉਟਪੁਟ:

1

ਉਦਾਹਰਣ 4

dim txt,pos
txt="This is a beautiful day!"
'binary comparison'
pos=InStrRev(txt,"t")
document.write(pos)

ਆਉਟਪੁਟ:

15