Einzelnen Beitrag anzeigen

nahpets
(Gast)

n/a Beiträge
 
#4

AW: StringReplace im Memo

  Alt 2. Jun 2017, 16:01
Delphi-Quellcode:
memo1.text := AnsiReplaceText(memo1.text,'cid:','');
memo1.text := AnsiReplaceText(memo1.text,'@1234567890','');
oder sowas (ungetestet)
Delphi-Quellcode:
function cidWeg(s : String) : String;
var
  i : Integer;
  k : Integer;
begin
  s := AnsiReplaceText(s,'cid:','');
  i := Pos('@',s);
  if i > 0 then begin
    k := PosEx('"', s, i);
    if k > 0 then begin
      Result := Copy(s,1,i - 1) + Copy(s,k,Length(s));
    end else begin
      Result := Copy(s,1,i - 1) + '"';
    end;
  end else begin
    Result := s;
  end;
end;

var
  x : Integer;
begin
  for x := 0 to memo1.Lines.Count - 1 do begin
    memo1.Lines[x] := cidWeg(memo1.Lines[x]);
  end;
end;
  Mit Zitat antworten Zitat