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 函数。
รูปแบบ
InStrRev(string1,string2[,start[,compare]])
ตัวแปร | รายละเอียด |
---|---|
start | ตัวเลือก กำหนดตำแหน่งเริ่มต้นการค้นหาทุกครั้ง โดยมาตรฐานคือตำแหน่งเริ่มต้นคือตัวอักษรแรก ถ้าได้กำหนดค่า compare ต้องมีค่านี้ |
string1 | จำเป็น ต้องการค้นหาข้อความที่ต้องการค้นหา |
string2 | จำเป็น ต้องการค้นหาข้อความ |
compare |
จำเป็น กำหนดชนิดการเปรียบเทียบข้อความที่ใช้ โดยมาตรฐานคือ 0 สามารถใช้ค่าดังนี้
|
ตัวอย่าง
ตัวอย่าง 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