Jump to content
Sign in to follow this  
n9mfk9

StringInStr?

Recommended Posts

n9mfk9

Hi all,

I have a question about StringInStr here is my test code

$location = StringInStr("How much wood" , "wood", 0, 1)
MsgBox(0,"",$location)

this gives me 10 is there a switch or something to make StringInStr go to the right insted of the left thanks for any help

Share this post


Link to post
Share on other sites
Jon

Hi all,

I have a question about StringInStr here is my test code

$location = StringInStr("How much wood" , "wood", 0, 1)
MsgBox(0,"",$location)

this gives me 10 is there a switch or something to make StringInStr go to the right insted of the left thanks for any help

-1 for the last parameter.

Share this post


Link to post
Share on other sites
Jon

-1 for the last parameter.

Or do you mean you want the position of the "d"?

Edit: In which case:

$location = StringInStrEnd("How much wood" , "wood", 0, 1)
MsgBox(0,"",$location)

Func StringInStrEnd($string, $search, $case, $occur)
 $pos = StringInStr($string, $search, $case, $occur)
 If $pos Then $pos = $pos + StringLen($search)
 return $pos
EndFunc

Share this post


Link to post
Share on other sites
n9mfk9

thanks jon that did it I was look for the d

thanks

Share this post


Link to post
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
Sign in to follow this  

×