Jump to content

StringSplit help


Recommended Posts

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 by ileandros

I feel nothing.It feels great.

Link to comment
Share on other sites

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 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

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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...