Old 11th June 2012, 19:45   #1
Squirre1
Member
 
Join Date: Aug 2001
Posts: 55
Send a message via ICQ to Squirre1
Split String based on character count

I have a solid string of data with no delimiter: 3da06e5577826ff8d3b4ab41ee4fbc72

How can I split it so I can process it two characters at a time:
3d a0 6e 55 77 82 6f f8 d3 b4 ab 41 ee 4f bc 72

if there is a way to split that into an array of 2 char values, that would almost be best.
${arrayname} = ('3d','a0','6e','55','77','82','6f','f8','d3','b4','ab','41','ee','4f','bc','72')

Please advise if you have any ideas or directions to look..

Thanks,

Squirre1
Squirre1 is offline   Reply With Quote
Old 11th June 2012, 20:00   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
code:
StrCpy $0 3da06e5577826ff8d3b4ab41ee4fbc72
StrLen $3 $0
StrCpy $1 0
Loop:
StrCpy $2 $0 "" $1
StrCpy $2 $2 2
detailprint $2
IntOp $1 $1 + 2
IntCmp $1 $3 loop loop 0




This only works properly if strlen is a multiple of 2. Fixing this is left as an exercise for the reader.
MSG is offline   Reply With Quote
Old 11th June 2012, 20:43   #3
Squirre1
Member
 
Join Date: Aug 2001
Posts: 55
Send a message via ICQ to Squirre1
Great, this put me in the right direction... I totally spaced on the maxlen and offset values that you can define for StrCpy...

I am going to throw that into a DoUntil loop while incrementing the offset and that will be perfect..

Thanks for the quick response..

Squirre1
Squirre1 is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump