does anyone here could share with me a working code to get a substring from a string?

maCo<maCo@somewhere.com>
how can I get the email string "maCo@somewhere.com"? :(
thank you
Posted on 2003-03-25 11:54:20 by maCo
You could check out the str.substr function in the HLA standard library. The source code is available at http://webster.cs.ucr.edu
Posted on 2003-03-25 12:27:58 by Odyssey

does anyone here could share with me a working code to get a substring from a string?

maCo<maCo@somewhere.com>
how can I get the email string "maCo@somewhere.com"? :(
thank you


Loop through the string byte by byte until you found a "<" and then write everything into a buffer until you find the next ">". Ya even dont need any API for that.
Posted on 2003-03-25 15:15:10 by bazik
maCo,

Have a look in the MASM32 library, there is an exact function that will do your example and there are others to do string manipulation.

Regards,

hutch@movsd.com
Posted on 2003-03-25 21:14:59 by hutch--



Loop through the string byte by byte until you found a "<" and then write everything into a buffer until you find the next ">". Ya even dont need any API for that.


Hmm, could u give a example of stepping it byte to byte?

thanks :)
Posted on 2003-03-26 00:25:05 by Drocon
Look at this thread. There you have an example of stepping through the string byte by byte until you found what you are looking for. In this case I am looking for "RMC" and the following characters until a 0Dh is found.

Hope it helps
Posted on 2003-03-26 00:57:38 by minor28


lea esi,buffer1
lea edi,buffer2
xor ecx,ecx
@@:
mov al,BYTE PTR[esi+ecx]
inc ecx
cmp al,"<"
jne @B
add esi,ecx
xor ecx,ecx
@@:
mov al,BYTE PTR[esi+ecx]
cmp al,">"
je @F
mov BYTE PTR[edi+ecx],al
inc ecx
jmp@B
@@:


Coded on the fly... inform me if it is wrong.
Posted on 2003-03-26 05:45:01 by roticv