break on
$A=strWildCmp("He??o W*d","Hello World")
? 'Result = '+$A
get $
;http:;www.codeproject.com/Articles/1088/Wildcard-string-compare-globbing 12-Aug-09 4:35
strWildCmp($wildstring,$matchstring)
dim $stopstring[1],$wildstringNew
$stopstring = '\0'
$wildstringNew=$wildstring
while($matchstring <> '\0')
if ($wildstring = '*')
do
$wildstring++;
EndIf
while ($wildstring = '*'); ; if a dork entered two or more * in a row
; ignore them and go ahead
if ($wildstring = '\0') ; if * was the last char, the strings are equal
$strWildCmp=$matchstring
else
$stopstring = $wildstring; ; the next char to check after the *
EndIf
Loop
EndIf
if($stopstring <> '\0')
if(($stopstring = $matchstring) or ($stopstring = '?') )
$wildstring++;
$stopstring = '\0';
EndIf
matchstring++;
else
if(($wildstring = $matchstring) or ($wildstring = '?'))
$wildstring++;
$matchstring++;
else
if(*$wildstring <> '\0')
$wildstring=$wildstringNew;
else
$strWildCmp=''
EndIf
EndIf
if( ($matchstring = '\0') and ($wildstring <> '\0') )
; matchstring seems to be too short. Check if $wildstring has any more chars except '*'
while ($wildstring = '*') ; ignore following '*'
$wildstring++;
Loop
if ($wildstring = '\0') ; if $wildstring endet after '*', strings are equal
$strWildCmp=$matchstring
else
$strWildCmp=''
EndIf
EndIf
Loop
EndFunction