Advertisement
emga9xkc

Tìm string nằm giữa 2 string

Feb 13th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.53 KB | None | 0 0
  1. Func _GetStr($str, $start = "", $end = "")
  2.     Local $LenStart = StringLen($start)
  3.     If $start = "" Then
  4.         Local $Pstart = 1
  5.     Else
  6.         Local $a = StringInStr($str, $start)
  7.         If $a == 0 Then Return -1
  8.         Local $Pstart = $a + $LenStart
  9.     EndIf
  10.     If $end = "" Then
  11.         Local $Pend = StringLen($str) + 1
  12.     Else
  13.         Local $Pend = StringInStr($str, $end, 0, 1, $Pstart)
  14.         If $Pend == 0 Then Return -2
  15.     EndIf
  16.     Return StringMid($str, $Pstart, $Pend - $Pstart)
  17. EndFunc   ;==>_GetStr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement