strfind( base, start, locate )


Parameters

  Type Description
base string string to search through
start numeric starting offset in base
locate string substring to find

_result

Set to a numeric value that is an offset into base.

Descriptions

Finds the first instance of the locate substring in the base string. The search for the locate substring is started at the offset specified by the start parameter. The search is case sensitive. The strfind command sets _result to the numeric offset of the beginning of locate found in base. If the locate substring is not found _result is set to -1. If part or all of the locate substring occurs before the start position it will not be found. If more than one instance of locate occurs in base, strfind sets _result to the offset of the first occurrence. The start parameter is zero based. To search from the beginning of base use a value of 0.

In the example below the first print command appends 5 to the print log. The second print command appends -1 to the print log since the matching string starts before the starting position.

base = "This is a message"
strfind( base, 0, "is a" )
print( _result )

strfind( base, 2, "This" )
print( _result )

See Also

strlen, strins, strmid, strbreak, strspan, stricmp, strrev, strtrim, strlower, strupper