Table of Contents

INSTR

Returns, as an integer, the position of the first character of a string within another

Implemented by: decbasic, cbmv7, cbmv3.5, msatari, trsdisk, level3, colorext, GWBASIC, MSX, bwbasic, bw32, ABasiC, QBasic, VBDOS, FreeBASIC, Gambas, ugBASIC, minibasicmm, minibasicjs

With variations: BBC (parameters order)

Also written as:

Usage

INSTR returns the position of the first character of a given string within another given string.

In some Microsoft BASICs at least, such as MSX, 0 would be returned if the substring could not be found, meaning that the character count of the searched string started at 1. Syntax is:

X = INSTR(?startpos?, haystr, needlestr)

where:

Variations

In BBC BASIC, the optional start position for the search was the last parameter, after the "hay" and the "needle" arguments.

Examples

Comments

Similar keywords

In other languages...

References