| Код | String ScvStringTools::RemoveTag(String sourcestrhtml,String needtags) { char* s1; char* s2; unsigned int* addrcontrsum; unsigned int contrsum[1000]; unsigned int addrneedtags[1000]; unsigned int es_,ds_,edi_,ecx_,ecx1,ecx2; unsigned int esi1,esi2,edi1,edi3,L; unsigned int koltags; String tmp = CopyStr(sourcestrhtml); s1=tmp.c_str(); s2=needtags.c_str(); ecx_=tmp.Length(); addrcontrsum=contrsum; asm { mov es_,es; mov ds_,ds; mov es,ds_; cmp ecx_,0; jz @g;
cld;
mov esi,s2; mov ecx,0; @w1:mov ebx,1; mov edx,0; mov eax,0; mov addrneedtags+ecx*4,esi;
@w:lodsb; cmp al,';'; jz @n1; cmp al,0; jz @n2; and al,11011111b; mov ds:[esi-1],al; mul bl; add edx,eax; inc ebx; jmp @w; @n1:mov contrsum+ecx*4,edx; inc ecx; jmp @w1; @n2:mov contrsum+ecx*4,edx; inc ecx; mov koltags,ecx;
mov esi,s1; mov edi,esi; mov ecx,ecx_; cld; @1:mov al,'<'; @2:cmp al,ds:[esi]; jz @3; movsb; loop @2; jmp @g; @3: mov edi1,edi; mov esi1,esi;
inc esi; cmp byte ptr ds:[esi], '/'; jnz @zt; inc esi; @zt:
mov edi,0; mov ebx,1; mov edx,0; mov esi2,esi; @w2:lodsb; cmp al,' '; jz @e1; cmp al,'>'; jz @e1; cmp al,0; jz @e1; inc edx; and al,11011111b; mov ds:[esi-1],al; mul bl; add edi,eax; inc ebx; jmp @w2; @e1:mov ecx1,ecx;
mov ecx,koltags; mov eax,edi; mov edi,koltags; shl edi,2; add edi,addrcontrsum; sub edi,4; @p1:std;
repnz scasd; jnz @no1;
mov ecx2,ecx; mov edi3,edi;
mov esi,esi2;
mov edi,[addrneedtags+ecx*4];
mov ecx,edx;
cld; repz cmpsb; mov ecx,ecx2; mov edi,edi3;
jnz @p1; jz @v;
@no1:cld; mov ecx,ecx1; mov al,'>'; mov edi,esi1; repnz scasb; mov esi,edi; sub edi,esi1; inc ecx; sub ecx_,edi; mov edi,edi1; jecxz @g; dec ecx; jnz @1; jmp @g; @v:mov ecx,ecx1; mov edi,edi1; mov esi,esi1; movsb;
dec ecx; jnz @1;
@g:mov es,es_; }; tmp.SetLength(ecx_); return tmp; }
|
пользуемся: | Код | RemoveTag("<html>123<br>123<hr>123","hr;br"); // вернёт "123<BR>123<HR>" RemoveTag("<html>123<br>123<hr>123",""); // вернёт "123123"
|
|