Name

find — Returns position of a substring

Synopsis

integer find ( string STRING1 ,
  string STRING2 );
 

Parameters

string STRING1

String

string STRING2

Substring

Return

integer

OFFSET If substring is not found find returns `-1'.

Description

The find function searches string for the first occurency of a specified substring (possibly a single character) and returns its starting position.

Returns the first position in STRING1 where the string STRING2 is contained in STRING1. OFFSET starts with 0.

Usage

  find ("abcdefghi", "efg") -> 4
  find ("aaaaa", "z") -> -1