Let's say I have a string:
myName db "trope",0
How would I loop through each character and perform some calculation on it? For instance, to make this simple, add 1 to each char's ascii code.
Thanks!
Trope
Hi Trope,
try something like this:
.DATA
szName db "trope",0
.CODE
_StringOp PROC
lea edx, szName
@@:
mov al, [edx]
test al,al
jz @F
add BYTE PTR [edx],1
inc edx
jmp @B
@@:
invoke MessageBox,NULL,ADDR szName,ADDR szName,MB_OK
xor eax,eax
RET
_StringOp EndP
This will display the resulting string "uspqf". Hope it helps.
Regards, phoenix