Archive: Looping through the chars of a string


Looping through the chars of a string
Hey all,

Lets say I have a string "abcd@#123", how can I loop through each character of this string and do some work with each char and then exit the loop after the last char?

Thanks


Name "Output"
OutFile "Output.exe"

Section
StrCpy $0 "abcd@#123"
StrCpy $1 0

loop:
StrCpy $2 $0 1 $1
StrCmp $2 '' end
IntOp $1 $1 + 1
#
MessageBox MB_OK '$$0={$0}$\n$$1={$1}$\n$$2={$2}'
#
goto loop

end:
SectionEnd

Works great, thanks so much Instructor!