Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #cs
- Simply put in ur $string, the $start where u wanna $start capturing and the $end.
- Like this
- $string = "<h1 class='someclass'>The 'data' i want</h1>"
- $start = "<h1 class='someclass'>"
- $end = "</h1>"
- and u will recive "The 'data' i want".
- You can even querry a array out of any text with this function.
- $string = "<h1 class='someclass'>The 'data' i want</h1>"
- $start = "'"
- $end = "'"
- If you put in this the return would be
- [0] someclass
- [1] data
- Thank you for using my work.
- BTW : please Test for StrInStr. If it not appears ull recive a error.
- #ce
- Func between($string, $start, $end, $array = 0)
- If $array = 0 Then
- $string = StringSplit($string, $start, 1)
- If $string[0] < 2 Then Return 0
- $string = $string[2]
- $string = StringSplit($string, $end, 1)
- If @error = 1 Then Return 0
- $string = $string[1]
- Return $string
- Else
- Local $startstring = StringSplit($string, $start, 1)
- Local $nextsplitt[1]
- For $i = 2 To $startstring[0] Step +1
- If $i <= $startstring[0] Then
- _ArrayAdd($nextsplitt, $startstring[$i])
- EndIf
- Next
- Local $returner[1]
- For $i = 1 To UBound($nextsplitt) - 1
- Local $rs = StringSplit($nextsplitt[$i], $end, 1)
- _ArrayAdd($returner, $rs[1])
- Next
- Return $returner
- EndIf
- ;Function by Nachid - U3C0
- ;schindler-it.org
- EndFunc ;==>between
Advertisement