i am trying to write a program that takes in a string maybe
Hi_there___my_friend ;(_)is considered a space
the output should have only single spaces btween the words
output:
Hi there my friend
here is what I have
.DATA
string1 DB 'Please input a string:',0
strlen EQU $-string1
insert db 'Insert a string',0
.CODE
INCLUDE io.mac
main PROC
.STARTUP
read_char:
putstr insert ;function to put out string
NWLN
getstr string1,strlen ;function to get string
mov ax,ds
mov es,ax
mov cx,strlen
mov DI,Offset string1
mov al,''
cld
repe scasb
dec di
mov al,bl
nwln
putstr string1 ;function to put out string
done:
.EXIT

main ENDP
END main
thanks for any help
Posted on 2001-11-24 12:36:13 by newbie
Errr... Maybe i missed the question here....? What help are you looking for again?.. and we'll need your IO.mac posted as well (or at least the important parts) to follow what your up to with certianty.

NaN
Posted on 2001-11-24 16:35:06 by NaN
newbie,

What you are after is not particularly hard to write, scan the string, replace the first occurrence of "_" with a space and continue looping back until the next character is NOT "_".

That will remove any repeats. I notice the code you posted is DOS code so what you write will depend on where you are going to use it. In win32 you cannot use that style of code as it uses segments but writing the same capacity in 32 bit is easier and will be a lot faster if speed matters.

Regards,

hutch@movsd.com
Posted on 2001-11-24 17:04:48 by hutch--