This is inefficient if the user only wants to check with the starting characterposition as 0 (AutoIt will internally perform StringLen(String) - StringLen(substring) - 1 more comparisons than required).
There are many ways of accomplishing what I've stated in AutoIt:
1. If StringLeft ("string", StringLen("substring") = "substring" Then Return 1
2. If StringRegExp("string", '^(?i)' &"substring" &'.*$') Then Return 1
and others...
But surprisingly they are much slower than StringInStr even with all its 'excess' comparisons (since AutoIt is an interpreted language). The only way this could be made faster was if StringInStr was given another option/parameter which would allow the user to specify a range of starting characters to check against (if not only the first one). This change can only be done internally in the AutoIt C++ source. The inclusion of these parameters can be made optional at the end of the current syntax so as not to affect existing scripts.
The performance benefits of this would be tremendous. And the way I see it, this inclusion will not increase the size of the distributable since only 2 additional variables are incorporated and maybe an additional line of C++ code or two (for condition checking).
This is the existing code. What I'm proposing is:StringInStr ( "string", "substring" [, casesense [, occurrence]] )
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, using the user's locale (default)
1 = case sensitive
2 = not case sensitive, using a basic/faster comparison
occurrence [optional] Which occurrence of the substring to find in the string. Use a negative occurrence to search from the right side. The default value is 1 (finds first occurrence).
If what I'm trying to convey is not clear enough, please do let me know...StringInStr ( "string", "substring" [, casesense [, occurrence[, start [,limit]]]] )
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, using the user's locale (default)
1 = case sensitive
2 = not case sensitive, using a basic/faster comparison
occurrence [optional] Which occurrence of the substring to find in the string. Use a negative occurrence to search from the right side. The default value is 1 (finds first occurrence).
start [optional] Which character in the main string to check from
1 (default)
limit [optional] How many comparisons to perform from the starting character
0 (default) = as many as possible








