Emiel Wieldraaijer Posted January 21, 2012 Share Posted January 21, 2012 (edited) Hi, Does someone know how to change the following 00000000000000000000000000000000 (this one has a variable length) into ************* *00000000* *00000000* *00000000* *00000000* ************* Thnx Emiel Edited January 21, 2012 by Emiel Wieldraaijer Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
water Posted January 21, 2012 Share Posted January 21, 2012 Did you already try it yourself? Do you have some code we can review? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted January 21, 2012 Share Posted January 21, 2012 Or quick and dirty: $iPartlen = 5 $sString = "000000000000000000000000000000000000000000000000000000000000000000000000" $iPos = 1 While 1 If $iPos >= StringLen($sString) Then Exitloop ConsoleWrite ("*" & StringMid($sString, $iPos, $iPartlen) & "*" & @CRLF) $iPos += $iPartlen Wend My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted January 21, 2012 Author Share Posted January 21, 2012 No i did not have any code .. i could not get my mind clear the find the solution for this And now i see your code .. it's simple.. i need to get some sleep... maybe that will help Thnx Cheers Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
water Posted January 21, 2012 Share Posted January 21, 2012 Good night My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
czardas Posted January 22, 2012 Share Posted January 22, 2012 (edited) Here's a simple snippet I wrote a while back. It splits a string into equal length segments. Any remaining characters appear in the last array element. #include <Array.au3> Local $string = "1a2b3c4d5e6f7g8h9i" ; string to split Local $iLimit = 5 ; length of each segment Local $array = StringRegExp($string, "(?s).{1," & $iLimit & "}", 3) ; the magic _ArrayDisplay($array) Edited January 22, 2012 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted January 22, 2012 Author Share Posted January 22, 2012 @Water Thanks again.. really simple @Czardas Thanks also a nice example Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
water Posted January 22, 2012 Share Posted January 22, 2012 Glad you like it My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Malkey Posted January 22, 2012 Share Posted January 22, 2012 This creates a long string, and then splits the long string. Local $iPartlen = 8 ; From http://www.autoitscript.com/forum/index.php?showtopic=101594&view=findpost&p=722113 Local $sString = StringRegExpReplace(StringFormat("%" & ($iPartlen * 4) & "s", " "), ".", "0") ; = 32 "0"'s = "00000000000000000000000000000000" ConsoleWrite("*************" & @LF & StringRegExpReplace($sString, "(.{" & $iPartlen & "})", "*\1*" & @LF) & "*************" & @CRLF) #cs Console output:- ************* *00000000* *00000000* *00000000* *00000000* ************* #ce 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