If i hava a string 'asdf/fsdfsd/sdfsd', how can i replace the "/" char with another char?
Posted on 2003-05-22 05:59:54 by Ghirai
hi Ghirai, could you post your snippet code for us, to see what are you gonna do with that string? i dont understand what is the difficulty :(
Posted on 2003-05-22 07:01:17 by dion



.386
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib

.data
buffer db 'asdf/fsdfsd/sdfsd',0
.code
start:
push esi
lea esi,buffer
@@:
mov al,byte ptr [esi]
or al,al
jz _end ;Have we reached the end of string?
cmp al,'/'
.IF ZERO? ; Check the zero flag
mov byte ptr [esi],'\' ; Replace / with \
.ENDIF
inc esi
jmp @b
_end:
invoke StdOut,addr buffer
pop esi
invoke ExitProcess,0
end start

Posted on 2003-05-22 07:05:09 by Vortex
mov ecx,stringlength

lea esi,source
stringloop_:
mov al,[esi]
cmp al,'/'
jnz @F
mov byte ptr[esi], wateveryouwanttoreplace
@@:
dec ecx
jnz stringloop_

*Note: Untested.
Simple code. What is so hard about it?
Posted on 2003-05-22 07:05:37 by roticv
Hehe, it might not be so difficult for you guys... :)
Thanks for the quick answers everyone.
Posted on 2003-05-22 09:29:51 by Ghirai
Hello :) It's a small world :)
Posted on 2003-05-23 12:33:43 by Drocon
Hey, hehe, nice to see you here :)
Posted on 2003-05-23 12:39:24 by Ghirai