Thema: Delphi Stringfilter

Einzelnen Beitrag anzeigen

Oreaden

Registriert seit: 10. Nov 2008
60 Beiträge
 
#16

Re: Stringfilter

  Alt 28. Jun 2009, 11:34
@himitsu: mhhh, 'ne ansi funktion... hier mal etwas, was auch chinesische zeichen ordentlich rausfiltert... ;-9

Delphi-Quellcode:
procedure f(var s, p: string);
var
  x: string;
  c: char;
  i: integer;
begin
  if (length(s) = 0) or (length(p) = 0) then exit;
  x := s;
  s := EmptyStr;
  setlength(s, length(x));
  i := 0;
  for c in x do
    if pos(c, p) = 0 then
    begin
      inc(i);
      s[i] := c;
    end;
  setlength(s, i);
end;
ob's jemand braucht, ist 'ne andere frage

btw: TSysCharSet = set of ansichar
  Mit Zitat antworten Zitat