News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

remove

Started by ragdog, January 28, 2008, 01:49:57 PM

Previous topic - Next topic

ragdog

hi

i have a question to remove all 0 from string

example string: 00012345 to 12345



             invoke GetDlgItemText,hWnd,1001,addr lpBuffer,9

             xor esi,esi
             mov ebx,offset lpBuffer
         @@:
             cmp BYTE PTR [ebx],"0"
             jnz @out
             inc ebx
             inc esi
             cmp esi,8
             jnz @B
             
             invoke MessageBox,hWnd,addr lpBuffer,0,MB_OK     
        @out:



greets
ragdog

Tedd


    invoke GetDlgItemText,hWnd,1001,addr lpBuffer,9

    xor esi,esi
    mov ebx,offset lpBuffer
  @@:
    cmp BYTE PTR [ebx],"0"
    jnz @out
    inc ebx
    inc esi
    cmp esi,8
    jnz @B
;small problem if the whole string was only "0" - will get here, but ebx will point 'after' the string.
;you should maybe also check for the terminating-null ;)
  @out:
    invoke MessageBox,hWnd,ebx,0,MB_OK

No snowflake in an avalanche feels responsible.

ragdog

thanks for you reply

its a error

example: ist the buffer 00000123

print: 12300000123





evlncrn8

sounds like a dirty buffer... debug it and see whats happening?

ragdog

this problem is solved
thanks