INSTRB

The INSTRB function searches a string for a substring using bytes and returns the position in the string that is the first byte of a specified occurrence of the substring.

To search a string for a substring using characters, use INSTR.

Return Value

A nonzero INTEGER when the search is successful or 0 (zero) when it is not.

Syntax

INSTRB (string , substring [, position [, occurrence]])

Arguments

string

The text expression to search.

substring

The string to search for.

position

A nonzero INTEGER indicating the byte of string where the function begins the search. When position is negative, then INSTRB counts and searches backward from the end of string. The default value of position is 1, which means that the function begins searching at the first byte of string.

occurrence

An INTEGER indicating which occurrence of string the function should search for. The value of occurrence must be positive. The default values of occurrence is 1, meaning the function searches for the first occurrence of substring.

Examples

This example assumes a double-byte database character set.

SHOW INSTRB('Corporate Floor','or',5,2) 
27