Mit der Funktion hier kann man einen formatierten
IRC-Text (also mit Farben etc.) in Plaintext konvertieren:
Delphi-Quellcode:
function Filter(eContent: String): String;
function IsNumeric(eChar: Char): Boolean;
begin
Result := Pos(eChar, '0123456789') <> 0;
end;
var
i: integer;
eFound: Boolean;
eFoundComma: Boolean;
begin
i := 1;
eFound := False;
eFoundComma := False;
while i <> Length(eContent) + 1 do
begin
if (eContent[i] = #3) or (eContent[i] = #31) or (eContent[i] = #2) then
begin
Delete(eContent, i, 1);
eFound := True;
eFoundComma := False;
end else
if (IsNumeric(eContent[i])) then
begin
if eFound then
Delete(eContent, i, 1)
else
i := i + 1;
end else
if (eContent[i] = ',') and (not eFoundComma) and (eFound) then
begin
eFoundComma := True;
Delete(eContent, i, 1);
end else
begin
i := i + 1;
eFound := False;
end;
end;
Result := eContent;
end;
[edit=Chakotay1308]Aktualisierte Version eingefügt. Mfg, Chakotay1308[/edit]
[edit=Matze]Code formatiert. Mfg, Matze[/edit]