توضیحات

این تابع مکان یک زیررشته را در رشته نشان می‌دهد.

دستور

تابع INSTR به صورت زیر نوشته می‌شود:

INSTR( string, substring [, start_position [, th_appearance ] ] )

string: رشته‌ای که می‌خواهیم در آن سرچ کنیم.
substring: زیر رشته‌ای که می‌خواهیم مکان آن را پیدا کنیم.
start_position: گزینه‌ای اختیاری است، جایی را نشان می‌دهد که می‌خواهیم از آن‌جا سرچ کنیم.
nth_appearance: گزینه‌ای اختیاری است.

 

 


مثال

مثالی از خروجی تابع INITCAP را مشاهده می‌کنیم:

INSTR('Tech on the net', 'e')
Result: 2   (the first occurrence of 'e')

INSTR('Tech on the net', 'e', 1, 1)
Result: 2   (the first occurrence of 'e')

INSTR('Tech on the net', 'e', 1, 2)
Result: 11  (the second occurrence of 'e')

INSTR('Tech on the net', 'e', 1, 3)
Result: 14  (the third occurrence of 'e')

INSTR('Tech on the net', 'e', -3, 2)
Result: 2