Advertisement
Guest User

Untitled

a guest
May 6th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.94 KB | None | 0 0
  1.  
  2.  
  3. MsgBox(0,"",StrMatch("2auttioit22", "autoit", True))
  4.  
  5. Func StrMatch($str, $match, $returnStr = False)
  6.  
  7.     If $str = "" Or $match = "" Then Return False
  8.     Local $aStr = StringSplit($str, "", 1)
  9.     Local $aMatch = StringSplit($match, "", 1)
  10.     Local $aCheck[UBound($aMatch)], $isMatch = False
  11.  
  12.     For $i = 1 To $aStr[0]
  13.  
  14.         For $k = 1 To $aMatch[0]
  15.  
  16.             If $aMatch[$k] == $aStr[$i] Then
  17.                 For $j = $i To $aStr[0]
  18.  
  19.                     $isMatch = False
  20.                     For $z = 1 To $aMatch[0]
  21.  
  22.                         If $aMatch[$z] == $aStr[$j] Then
  23.  
  24.                             $isMatch = True
  25.                             If $aCheck[$z] = False Then
  26.                                 $aCheck[$z] = True
  27.                                 ExitLoop
  28.                             EndIf
  29.                         EndIf
  30.                     Next
  31.  
  32.                     If $isMatch = False Then ExitLoop
  33.                 Next
  34.  
  35.                 $isMatch = True
  36.                 For $o = 1 To $aMatch[0]
  37.                     If $aCheck[$o] = False Then $isMatch = False
  38.                     $aCheck[$o] = False
  39.                 Next
  40.  
  41.                 If $isMatch Then Return $returnStr ? StringMid($str, $i, $j - $i) : $i
  42.             EndIf
  43.         Next
  44.     Next
  45. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement