Function Reference

StringInStr

Checks if a string contains a given substring.

StringInStr ( "string", "substring" [, casesense [, occurance]] )

 

Parameters

string The string to evaluate.
substring The substring to search for.
casesense [optional] Flag to indicate if the operations should be case sensitive.
0 = not case sensitive (default)
1 = case sensitive
occurance [optional] Which occurance of the substring to find in the string. Use a negative occurance to search from the right side. The default value is 1 (finds first occurance).

 

Return Value

Success: Returns the position of the substring.
Failure: Returns 0 if substring not found.
@Error 0 - Normal operation
1 - Occurance was 0. Occurance must be a positive or negative integer.

 

Remarks

The first character position is 1. If occurance is given, casesense must also be given.

 

Related

String, StringLeft, StringLen, StringLower, StringMid, StringRight, StringTrimLeft, StringTrimRight, StringUpper

 

Example


$result = StringInStr("I am a String", "RING")
MsgBox(0, "Search result:", $result)

$location = StringInStr("How much wood could a woodchuch chuch is a woodchuck could chuck wood?", "wood", 0, 3) ; Find the 3rd occurance of "wood"