nitekram Posted July 19, 2006 Share Posted July 19, 2006 (edited) I.E . $stringtest = "1+1=2,2+2=4,4+4=6" $stringPrint = stringsplit($stringtest, "=") msgbox(0,$stringtest,$stringPrint[2]) I would like the msgbox to return 2,2+2=4,4+4=6. If this is not available can the mods move it to the idea lab forum? Maybe make another flag: $stringtest = "1+1=2,2+2=4,4+4=6" $stringPrint = stringsplit($stringtest, "=",2) msgbox(0,$stringtest,$stringPrint[2]) Where the flag 2 will put everthing into the second array. If there is something else out there please disreguard request and show me the light - EDIT change suggestion to idea lab Edited July 19, 2006 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Helge Posted July 19, 2006 Share Posted July 19, 2006 $string = "1+1=2,2+2=4,4+4=6" $pos = StringInStr($string, "=") If NOT @error Then MsgBox(64, "", '"' & StringTrimLeft($string, $pos) & '"') Link to comment Share on other sites More sharing options...
nitekram Posted July 19, 2006 Author Share Posted July 19, 2006 $string = "1+1=2,2+2=4,4+4=6" $pos = StringInStr($string, "=") If NOT @error Then MsgBox(64, "", '"' & StringTrimLeft($string, $pos) & '"') I wish I knew how to code - If I did then I would have been able to figure this out and not wasted your time nor everyone elses. === Thanks for your help - 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Squirrely1 Posted July 21, 2006 Share Posted July 21, 2006 (edited) Probably what Helge meant would include the initial "=" sign in your string: $string = "1+1=2,2+2=4,4+4=6" $pos = StringInStr($string, "=") If NOT @error Then MsgBox(64, "", '"' & StringTrimLeft($string, $pos - 1) & '"') $desired_Result = StringTrimLeft($string, $pos - 1) but this would have worked so you were on the right track: $stringtest = "1+1=2,2+2=4,4+4=6" $stringPrint = StringSplit($stringtest, "=") If @error Then MsgBox(0, "Error", "No delimiter was found.") Else Local $desired_Result = "=" For $i = 2 To UBound($stringPrint) - 1 $desired_Result &= $stringPrint[$i] Next MsgBox(0, $stringtest, $desired_Result) EndIf Don't you use SciTe (available at the AutoIt download site)? It leaves you with more readable syntax by using autocomplete and color-highlighting. Edited July 21, 2006 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
Helge Posted July 21, 2006 Share Posted July 21, 2006 I would like the msgbox to return 2,2+2=4,4+4=6.Maybe I misunderstood that sentence (), or maybe I just don't understand whatyou are saying Squirrely1, because isn't my MsgBox showing exactly what he wanted..? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 21, 2006 Moderators Share Posted July 21, 2006 (edited) Maybe I misunderstood that sentence (), or maybe I just don't understand what you are saying Squirrely1, because isn't my MsgBox showing exactly what he wanted..?Well you know I have to throw my 2 cents in $string = "1+1=2,2+2=4,4+4=6" $pos = StringMid($string, StringInStr($string, "=") + 1) MsgBox(64, "", '"' & $pos & '"') Edited July 21, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MHz Posted July 21, 2006 Share Posted July 21, 2006 ...isn't my MsgBox showing exactly what he wanted..?This is the most direct method MsgBox(0, '', '2,2+2=4,4+4=6') Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 21, 2006 Moderators Share Posted July 21, 2006 This is the most direct method MsgBox(0, '', '2,2+2=4,4+4=6') MHz came with jokes!! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 21, 2006 Share Posted July 21, 2006 MHz came with jokes!! That's really funny. So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Squirrely1 Posted July 21, 2006 Share Posted July 21, 2006 Maybe I misunderstood that sentence (), or maybe I just don't understand whatyou are saying Squirrely1, because isn't my MsgBox showing exactly what he wanted..?I'm not so sure of my untested code there Helge and you would have probably found some of what I did if you had given the topic more consideration (which might be more than it is worth). You must be referring to my amended version of your code. Instead ofIf NOT @error Then MsgBox(64, "", '"' & StringTrimLeft($string, $pos) & '"')it seemed you should subtract 1 from $pos to get the "=" in there:If NOT @error Then MsgBox(64, "", '"' & StringTrimLeft($string, $pos - 1) & '"')Also, I wanted to help the newbie see that what he had in mind could work. However, 4+4 in base 10 will never equal 6 unless the communists take over again in Yugoslavia. Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
nitekram Posted July 21, 2006 Author Share Posted July 21, 2006 (edited) but this would have worked so you were on the right track: $stringtest = "1+1=2,2+2=4,4+4=6" $stringPrint = StringSplit($stringtest, "=") If @error Then MsgBox(0, "Error", "No delimiter was found.") Else Local $desired_Result = "=" For $i = 2 To UBound($stringPrint) - 1 $desired_Result &= $stringPrint[$i] Next MsgBox(0, $stringtest, $desired_Result) EndIf The code above does not work...the way it is now. I need to include the whole string from the delimiter to the end of the line. That is why I thought it might be a good idea to include another flag. But what I have works, but I think I like your idea. Anyway sorry about the string math, but it was a string, and yes I use Scite. Thanks for your time. Edit - the string looks like this DEFAULTURL=http://www.autoitscript.com/forum/index.php?act=post&do=edit_post&f=2&t=29405&p=210913&st=0 so I really do not need or want the first accuance, but everything afterwards Edited July 21, 2006 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator 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