ravenfyre 0 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 Share this post Link to post Share on other sites
Holger 14 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 colorsOther old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Share this post Link to post Share on other sites
ravenfyre 0 Posted August 28, 2004 Hmm that's kinda odd. Oh well I guess that would be the easy way out ^^. Share this post Link to post Share on other sites
Jos 2,175 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. Share this post Link to post Share on other sites
this-is-me 6 Posted August 28, 2004 You could do StringLen($test) - $check Who else would I be? Share this post Link to post Share on other sites