ravenfyre Posted August 28, 2004 Posted August 28, 2004 (edited) Howdy folks. I'm using StringinStr and would like to search from the right, instead of the left. Taken directly from the help file, "Use a negative occurance to search from the right side." Unfortunately it doesn't work, I still get results from the left hand side of the string. Just run my simple example and see. StringInStr ( "string", "substring" [, casesense [, occurance]] ) $test = "3,2,1" $num = 1; $check = StringInStr($test,$num,0,-1); msgbox(0, "test", "should be 1: "&$check); It should be 1, not 5, if it searched from the right. A bug, or am I overlooking something? Edited August 28, 2004 by ravenfyre
Holger Posted August 28, 2004 Posted August 28, 2004 (edited) No, that is not a bug.It's not necessary from which side you're searching for a string, the string position will be ever the same!.("Success: Returns the position of the substring.") Edited August 28, 2004 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
ravenfyre Posted August 28, 2004 Author Posted August 28, 2004 Hmm that's kinda odd. Oh well I guess that would be the easy way out ^^.
Developers Jos Posted August 28, 2004 Developers Posted August 28, 2004 Hmm that's kinda odd. Oh well I guess that would be the easy way out ^^. <{POST_SNAPBACK}>Its not really "the easy way out" but its the way all string functions work. It would be more difficult to use other String commands when it would return the found position seen from the right, since they all use the position from the left. Just an example: Assume you want to find the last octet of an IP address: $IP = "192.168.0.213" $oct4 = StringTrimLeft($IP,StringInStr($IP,".",0,-1)) MsgBox(0,'ip',$oct4) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
this-is-me Posted August 28, 2004 Posted August 28, 2004 You could do StringLen($test) - $check Who else would I be?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now