Biatu Posted May 2, 2015 Share Posted May 2, 2015 I have this script here and im attempting to run this for loop and accumulate an integer, but skip numbers like 0, 10-90, 100-110...basically anything thing that has a zero.here is my current attempt, but it never works quite right when integers are bigger than 100: Local $iCharIdx=1 For $i=1 To 97 ConsoleWrite($iCharIdx&@CRLF) $iCharIdx+=1 While Not Mod($iCharIdx,10) $iCharIdx+=1 WEnd Next What is what? What is what. Link to comment Share on other sites More sharing options...
nitekram Posted May 2, 2015 Share Posted May 2, 2015 For $i=1 To 1197 If Not StringInStr($i, 0) Then ConsoleWrite($i&@CRLF) Next 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...
kaisies Posted May 2, 2015 Share Posted May 2, 2015 I have this script here and im attempting to run this for loop and accumulate an integer, but skip numbers like 0, 10-90, 100-110...basically anything thing that has a zero.here is my current attempt, but it never works quite right when integers are bigger than 100: Local $iCharIdx=1 For $i=1 To 97 ConsoleWrite($iCharIdx&@CRLF) $iCharIdx+=1 While Not Mod($iCharIdx,10) $iCharIdx+=1 WEnd Next Yeah.... I don't understand, changing the For loop ubound outputs as expected, skipping every 10th number.... are you trying to skip any number with a zero in it, like skip 101? Just use StringInStr($i,"0") then? Link to comment Share on other sites More sharing options...
jguinch Posted May 2, 2015 Share Posted May 2, 2015 Seems to work : if I try 1 to 200 with you code, no integer divisible by 10 appears in the console.Also, this should be simplier :For $i=1 To 200 If Mod($i, 10) Then ConsoleWrite($i & @CRLF) Next Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
lorenkinzel Posted May 2, 2015 Share Posted May 2, 2015 (edited) From your description it looks like: 0 or divisible by 10.But that wouldn't work with, say, 109.As a low-budget idea, would a StringLen with a StringStripCR & compare the 2 do the trick?Edit: there were no replies when I started typing. Doesn't say much for my typing speed Eh? Edited May 3, 2015 by lorenkinzel Link to comment Share on other sites More sharing options...
Biatu Posted May 2, 2015 Author Share Posted May 2, 2015 (edited) I found a workaround, but was hoping to work out a simpler solution. And yes kaisies, any number with a zero in it needed to be skipped..but without any other extra funcs.Since i already knew the expected size, excluding all the integers with a 0..which is 117 i just used this: Local $iCharIdx=1 For $i=1 To 117 If StringInStr($i,"0") Then ContinueLoop $iCharIdx+=1 Next$iCharIdx would end at 97 and expected. Edit: Thanx Guys!Edit2: Patch Edited May 2, 2015 by Biatu What is what? What is what. Link to comment Share on other sites More sharing options...
SadBunny Posted May 2, 2015 Share Posted May 2, 2015 You don't even need the String() in there. See Nitekrams example. Biatu 1 Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Biatu Posted May 2, 2015 Author Share Posted May 2, 2015 (edited) I thought using Mod() 10 would work but when it hits 100+ it goes out the window :/Edit: My original example is a for loop with a BinaryMid function for a character set, whereas im building an index leaving out the 0's. Edited May 2, 2015 by Biatu What is what? What is what. 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