flat assembler
Message board for the users of flat assembler.

Index > Windows > How to replace a symbol with another one - (de)encrypter

Author
Thread Post new topic Reply to topic
gumletis



Joined: 18 Dec 2004
Posts: 128
gumletis
hi, i need some few ways to manipulate strings, i know the basic(lstrcat, lstrcpy) but need someone to find&replace a symbol in a string, some ideas? ps also wanna do it with mov instructions and stuff like that

.Thanks Martin...

_________________
LOOOL
Post 25 Dec 2004, 13:17
View user's profile Send private message Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
to find replace, i guess, the step is to compare them first, if equal, then replace it.

lstrcmp,str1,str2
je -> equal and replace it

lstrcpy,str1,str1Replace
Post 25 Dec 2004, 15:41
View user's profile Send private message Visit poster's website Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc
While I haven't tested this, something like the following example should be enough to give you some idea as to how to do this in assembly:

Code:
...
mov esi, msg1
call replace
...

replace:
  mov eax, byte [esi]
  cmp eax, '-'
  jz .change
  cmp eax, 0  ; end of string
  jz .exit
.next: inc esi
  jmp replace
.change: mov eax, ' '  ; a space
  mov [esi], byte eax
  jmp .next
.exit: ret

...
msg1 db 'hello-world',0
    
Post 25 Dec 2004, 15:47
View user's profile Send private message Visit poster's website Reply with quote
gumletis



Joined: 18 Dec 2004
Posts: 128
gumletis
thanks work....

_________________
LOOOL
Post 26 Dec 2004, 12:10
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.