Squirre1
11th June 2012 20:45 UTC
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
MSG
11th June 2012 21:00 UTC
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.
Squirre1
11th June 2012 21:43 UTC
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