Jump to content

Between function ?


Recommended Posts

Hi does someone already developed an between function ?

I need it badly :D

For example : Between("this is my very long text string","my","long")

should return " very ")

Thnx.

:huh2:

What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!
Link to comment
Share on other sites

Func _Between($input,$before,$after)
  Local $where_before, $where_after
  $where_before = StringInStr($input,$before)
  $where_after = StringInStr($input,$after)
  If $where_after <> 0 AND $where_before <> 0 Then
    Return StringMid($input,$where_before + 1 + StringLen($Where_before), _
    Where_after - 1 - $Where_before - StringLen($Where_before))
  Else
    Return 0
  EndIf
EndFunc

Try that!

Edited by ezzetabi
Link to comment
Share on other sites

Func _Between($input,$before,$after)
 Local $where_before, $where_after
 $where_before = StringInStr($input,$before)
 $where_after = StringInStr($input,$after)
 If $where_after <> 0 AND $where_before <> 0 Then
    If $where_before => $where_after Then
       SetError ( -1 )
       Return 0
    EndIf
    Return StringMid($input,$where_before + 1 + StringLen($Where_before), _
    Where_after - 1 - $Where_before - StringLen($Where_before))
 Else
    SetError ( 1 ) 
    Return 0
 EndIf
EndFunc

Solved... Still it was not intended as a challenge, I was just joking.

Edited by ezzetabi
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...