CyberGlitch Posted March 29, 2004 Share Posted March 29, 2004 Ok, my head isn't working correctly enough to figure this out. Need to find something in a string read backwards until a space and delete anything found. Example. Name 1234;Address 12;phone Would want to delete out 1234; and 12; to get Name Address phone Can't think of a good way to do this. I know you would want to find ; and go char by char backwards making sure it's a num until a space is found then stop but have tried many things to no avail. Someone please show me the light! Link to comment Share on other sites More sharing options...
Developers Jos Posted March 29, 2004 Developers Share Posted March 29, 2004 (edited) what about this way? $test= "Name 1234;Address 12;phone" $test = StringReplace($test,"1234;","") $test = StringReplace($test,"12;","") Edited March 29, 2004 by JdeB 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. Link to comment Share on other sites More sharing options...
CyberGlitch Posted March 29, 2004 Author Share Posted March 29, 2004 Sorry, I should have been more clear, the numbers are vairable and change from line to line. Link to comment Share on other sites More sharing options...
Developers Jos Posted March 29, 2004 Developers Share Posted March 29, 2004 (edited) ok ... understood.... what about this code: $test= "Name 1234;Address 12;phone" While StringInstr($test,";") > 0 $c1 = StringInstr($test,";") For $x = $c1 to 1 step -1 if StringMid($test,$x,1) = " " then ExitLoop Next $test = StringLeft($test,$x) & StringTrimLeft($test,$c1) Wend msgbox(0,'test',$test) Edited March 29, 2004 by JdeB 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. Link to comment Share on other sites More sharing options...
CyberGlitch Posted March 29, 2004 Author Share Posted March 29, 2004 I knew my brain stopped working after I had lunch. Works great, doesn't like working with my current script but can run seperatly and it works. I give up for today. Thank you so very much again. Link to comment Share on other sites More sharing options...
redndahead Posted March 29, 2004 Share Posted March 29, 2004 Here is another way. $test= "Name 1234;Address 12;phone" $SplitLine = StringSplit($test," ") $Length = StringLen($SplitLine[$SplitLine[0]]) $Output = StringTrimRight($Test,$Length + 1) MsgBox(0,"Output",$Output) Exit red Link to comment Share on other sites More sharing options...
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