
17.03.2013, 22:11
|
 |
.
|
|
Регистрация: 18.05.2011
Адрес: Омск
Сообщения: 3,970
Версия Delphi: 3,5,7,10,12,XE2
Репутация: выкл
|
|
Попробуй так
Код:
function DelParagraph(const Str1,Str2:string; L:integer):string;
var
J, I, Count, D, G : Integer;
Word1, Word2 : String;
T1, T2 : TStringList;
begin
Result := '';
Count := 0;
if Length(Str1) = 0 then
Exit;
T1 := TStringList.Create;
try
T2 := TStringList.Create;
try
T2.Sorted := True;
T2.Duplicates := dupIgnore;
T1.Text := SpliteText(Del(Str1));
G := T1.Count;
T2.Text := SpliteText(Str2);
for I := 0 to T2.Count - 1 do
begin
Word1 := T2[i];
begin
for J := 0 to T1.Count - 1 do
begin
Word2 := T1[J];
if CompareWords(Word1, Word2) then
Inc(Count);
end;
end;
end;
if (Count = 0) or (G = 0) then
Exit
else
D := Count * 100 Div G;
if D > L then
Result := Str1;
finally
FreeAndNil(T2);
end;
finally
FreeAndNil(T2);
end;
end;
__________________
Je venus de nulle part
55.026263 с.ш., 73.397636 в.д.
|