MS Access InStr()ฟังก์ชัน
ตัวอย่าง
ค้นหา "t" ในสตริง "ลูกค้า" และส่งคืนตำแหน่ง:
SELECT InStr("Customer", "t") AS MatchPosition;
ความหมายและการใช้งาน
ฟังก์ชัน InStr() รับตำแหน่งของสตริงที่เกิดขึ้นครั้งแรกในอีกอันหนึ่ง
ฟังก์ชันนี้ทำการค้นหาแบบคำนึงถึงขนาดตัวพิมพ์
ไวยากรณ์
InStr(start, string1, string2,
compare)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
start | Optional. The start position for the search. Position 1 is default |
string1 | Required. The string to be searched |
string2 | Required. The string to search for |
compare | Optional. The type of string comparison. Possible values: -1: Use the setting of Option Compare 0: Binary comparison 1: Textual comparison 2: Comparison based on info in your database |
ส่งกลับค่า
- หากไม่พบ string2 ภายใน string1 ฟังก์ชันนี้จะคืนค่า 0
- ถ้า string1 มีความยาวเป็นศูนย์ ฟังก์ชันนี้จะคืนค่า 0
- ถ้า string1 เป็นค่าว่าง ฟังก์ชันนี้จะคืนค่า null
- ถ้า string2 มีความยาวเป็นศูนย์ ฟังก์ชันนี้จะคืนค่าใน start parameter
- ถ้า start เป็น > มากกว่าความยาวของ string2 ฟังก์ชันนี้จะคืนค่า 0
รายละเอียดทางเทคนิค
ทำงานใน: | จากการเข้าถึง 2000 |
---|