ileandros Posted March 4, 2013 Share Posted March 4, 2013 (edited) Please help i am going crazy with these string functions. I got a big hex like this: $data = "0x30783330373833333330333733383333333633333338333333373333333433333337333333343333333733333330333333373333333333333333333433313333333233343336333333323334333633333337333333333333333333333332333333333333333533333333333333393333333233343335333333363333333833333336333433363333333733333334333333363333333633333336333333393333333633343333333333363333333533333332333433353333333633333333333333363334333633333336333433343333333233343336333333363333333733333336333333353333333733333334333333323334333633333336333333313333333333333339333333333333333333333333333333353333333333333333333333363333333333333333333333333333333633333335333333333333333733333333333333333333333633333331333333333333333433333333333333373333333333333338333333333333333733333333333333323333333633333336333333333333333833333333333333363333333633333331333333333333333933333333333333363333333333333339333333333333333733333333333333393333333633333335333333363333333433333336333333343333333333333337333333333333333533333336333333353333333633333334333333333333333233333333333333383333333633333335333333363333333233333336333333343333333633333334333333333333333533333333333333363333333233343336333333333333333533333333333333313333333333333333333333333333333433333333333333303333333633333333333333363333333133333336333333333333333233343336333333333333333233333333333333353333333333333336333333323334333633333333333333373333333633333335333333333333333733333333333333353333333333333334333333333333333533333336333333353333333633333331333333333333333433333336333333333333333333333333333333333333333233333336333333363333333333333332333333333333333833333333333333383333333233343336333333363333333233333336333333323333333633333333333333333333333533333333333333383333333333333335333333363333333533333332333433363333333633343333333333363334333633333336333333373333333233343335333333363333333533333337333333383333333633333335" what i want to do is to console write this number from the beggining to end every 12 numbers + @CRLF. As i read the help files for stringsplit it isn't what i am looking for. Which function should i use? After an hour of headache i came up with this which doesnt seem to be excaclty what i wanted to achieve since it displays the stringlength and for some wierd reasons to me it does an endless loop $data = "0x30783330373833333330333733383333333633333338333333373333333433333337333333343333333733333330333333373333333333333333333433313333333233343336333333323334333633333337333333333333333333333332333333333333333533333333333333393333333233343335333333363333333833333336333433363333333733333334333333363333333633333336333333393333333633343333333333363333333533333332333433353333333633333333333333363334333633333336333433343333333233343336333333363333333733333336333333353333333733333334333333323334333633333336333333313333333333333339333333333333333333333333333333353333333333333333333333363333333333333333333333333333333633333335333333333333333733333333333333333333333633333331333333333333333433333333333333373333333333333338333333333333333733333333333333323333333633333336333333333333333833333333333333363333333633333331333333333333333933333333333333363333333333333339333333333333333733333333333333393333333633333335333333363333333433333336333333343333333333333337333333333333333533333336333333353333333633333334333333333333333233333333333333383333333633333335333333363333333233333336333333343333333633333334333333333333333533333333333333363333333233343336333333333333333533333333333333313333333333333333333333333333333433333333333333303333333633333333333333363333333133333336333333333333333233343336333333333333333233333333333333353333333333333336333333323334333633333333333333373333333633333335333333333333333733333333333333353333333333333334333333333333333533333336333333353333333633333331333333333333333433333336333333333333333333333333333333333333333233333336333333363333333333333332333333333333333833333333333333383333333233343336333333363333333233333336333333323333333633333333333333333333333533333333333333383333333333333335333333363333333533333332333433363333333633343333333333363334333633333336333333373333333233343335333333363333333533333337333333383333333633333335" $len = StringLen($data) ConsoleWrite($len & @CR) While (True) If $len <= 1870 Then Do $len = $len - 12 ConsoleWrite($len & @CRLF) Until StringLen($len) <= 0 EndIf WEnd Edited March 4, 2013 by ileandros I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
ripdad Posted March 4, 2013 Share Posted March 4, 2013 (edited) here is one way... Local $data = "0x30783330373833333330333733383333333633333338333333373333333433333337333333343333333733333330333333373333333333333333333433313333333233343336333333323334333633333337333333333333333333333332333333333333333533333333333333393333333233343335333333363333333833333336333433363333333733333334333333363333333633333336333333393333333633343333333333363333333533333332333433353333333633333333333333363334333633333336333433343333333233343336333333363333333733333336333333353333333733333334333333323334333633333336333333313333333333333339333333333333333333333333333333353333333333333333333333363333333333333333333333333333333633333335333333333333333733333333333333333333333633333331333333333333333433333333333333373333333333333338333333333333333733333333333333323333333633333336333333333333333833333333333333363333333633333331333333333333333933333333333333363333333333333339333333333333333733333333333333393333333633333335333333363333333433333336333333343333333333333337333333333333333533333336333333353333333633333334333333333333333233333333333333383333333633333335333333363333333233333336333333343333333633333334333333333333333533333333333333363333333233343336333333333333333533333333333333313333333333333333333333333333333433333333333333303333333633333333333333363333333133333336333333333333333233343336333333333333333233333333333333353333333333333336333333323334333633333333333333373333333633333335333333333333333733333333333333353333333333333334333333333333333533333336333333353333333633333331333333333333333433333336333333333333333333333333333333333333333233333336333333363333333333333332333333333333333833333333333333383333333233343336333333363333333233333336333333323333333633333333333333333333333533333333333333383333333333333335333333363333333533333332333433363333333633343333333333363334333633333336333333373333333233343335333333363333333533333337333333383333333633333335" $data = StringRegExpReplace($data, '(.{12})', '\1' & @CRLF) ConsoleWrite($data) -edit- and another way... Local $data = "0x30783330373833333330333733383333333633333338333333373333333433333337333333343333333733333330333333373333333333333333333433313333333233343336333333323334333633333337333333333333333333333332333333333333333533333333333333393333333233343335333333363333333833333336333433363333333733333334333333363333333633333336333333393333333633343333333333363333333533333332333433353333333633333333333333363334333633333336333433343333333233343336333333363333333733333336333333353333333733333334333333323334333633333336333333313333333333333339333333333333333333333333333333353333333333333333333333363333333333333333333333333333333633333335333333333333333733333333333333333333333633333331333333333333333433333333333333373333333333333338333333333333333733333333333333323333333633333336333333333333333833333333333333363333333633333331333333333333333933333333333333363333333333333339333333333333333733333333333333393333333633333335333333363333333433333336333333343333333333333337333333333333333533333336333333353333333633333334333333333333333233333333333333383333333633333335333333363333333233333336333333343333333633333334333333333333333533333333333333363333333233343336333333333333333533333333333333313333333333333333333333333333333433333333333333303333333633333333333333363333333133333336333333333333333233343336333333333333333233333333333333353333333333333336333333323334333633333333333333373333333633333335333333333333333733333333333333353333333333333334333333333333333533333336333333353333333633333331333333333333333433333336333333333333333333333333333333333333333233333336333333363333333333333332333333333333333833333333333333383333333233343336333333363333333233333336333333323333333633333333333333333333333533333333333333383333333333333335333333363333333533333332333433363333333633343333333333363334333633333336333333373333333233343335333333363333333533333337333333383333333633333335" Local $s = '' For $i = 1 To StringLen($data) Step 12 $s &= StringMid($data, $i, 12) & @CRLF Next ConsoleWrite($s) -edit2- Or maybe I misunderstood?... Local $data = "0x30783330373833333330333733383333333633333338333333373333333433333337333333343333333733333330333333373333333333333333333433313333333233343336333333323334333633333337333333333333333333333332333333333333333533333333333333393333333233343335333333363333333833333336333433363333333733333334333333363333333633333336333333393333333633343333333333363333333533333332333433353333333633333333333333363334333633333336333433343333333233343336333333363333333733333336333333353333333733333334333333323334333633333336333333313333333333333339333333333333333333333333333333353333333333333333333333363333333333333333333333333333333633333335333333333333333733333333333333333333333633333331333333333333333433333333333333373333333333333338333333333333333733333333333333323333333633333336333333333333333833333333333333363333333633333331333333333333333933333333333333363333333333333339333333333333333733333333333333393333333633333335333333363333333433333336333333343333333333333337333333333333333533333336333333353333333633333334333333333333333233333333333333383333333633333335333333363333333233333336333333343333333633333334333333333333333533333333333333363333333233343336333333333333333533333333333333313333333333333333333333333333333433333333333333303333333633333333333333363333333133333336333333333333333233343336333333333333333233333333333333353333333333333336333333323334333633333333333333373333333633333335333333333333333733333333333333353333333333333334333333333333333533333336333333353333333633333331333333333333333433333336333333333333333333333333333333333333333233333336333333363333333333333332333333333333333833333333333333383333333233343336333333363333333233333336333333323333333633333333333333333333333533333333333333383333333333333335333333363333333533333332333433363333333633343333333333363334333633333336333333373333333233343335333333363333333533333337333333383333333633333335" For $i = 1 To StringLen($data) Step 12 ConsoleWrite($i & @CRLF) Next Edited March 4, 2013 by ripdad "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
FireFox Posted March 4, 2013 Share Posted March 4, 2013 @ripdad I think you're right, but it would be very weird that ileandros wants to include the hex prefix. Therefore your $i start should be 3. Br, FireFox. Link to comment Share on other sites More sharing options...
czardas Posted March 4, 2013 Share Posted March 4, 2013 Not quite sure what you're doing, but maybe you might like to look at _StringEqualSplit(), or the modification by guinness further down the page. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
guinness Posted March 4, 2013 Share Posted March 4, 2013 Thanks for reminding me. I updated the code. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
czardas Posted March 5, 2013 Share Posted March 5, 2013 (edited) Thanks for reminding me. I updated the code.Yeah, I should change the error checking to what you have (tomorrow), it's neater. I see you simplified it. Edited March 5, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
guinness Posted March 5, 2013 Share Posted March 5, 2013 Yeh, it was just something I said the other day about exclusively checking for 0 or using Not when the value was boolean, that got me thinking. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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