AutoIt StringInStr Function
The StringInStr function can be used to find a string in another string.
3700 views

Edited: 2017-03-25 03:07
The AutoIt StringInStr is used to check for the existence of one string, inside another string. An example could be, checking if a given word or phrase exists, in a document or file.
Parameters
string | The source to be checked. | Required |
substring | The string to search for. | Required |
casesense | Controls the case sensitivity of the search.
| Optional |
occurrence | Controls which occurrence in the string to find. Use a negative value to search from the right. Default is 1. | Optional |
start | The start position of the search. | Optional |
count | The maximum number of characters to search for.
| Optional |
AutoIt StringInStr example
In the below example, the $Source variable is checked for the $StringToCheckFor variable.
The $Source contains the loaded data, and the $StringToCheckFor is whatever is to be checked for, such as a word or phrase.
$Source = 'The poo is in the toilet.'; $StringToCheckFor = 'poo'; $result = StringInStr($Source, $StringToCheckFor) If $result > 1 Then MsgBox(0, $StringToCheckFor & " Found", $Source) EndIf
Tell us what you think: