Registriert seit: 1. Feb 2018
3.691 Beiträge
Delphi 11 Alexandria
|
AW: Problem mit Pos/PosEx
11. Apr 2021, 23:41
Delphi-Quellcode:
program Project13;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
const
derText = ' [[Hamburg]] || 2008 ||data-sort-value="Diplomica"| [[Diplomica Verlag|Verlagsgruppe Diplomica]] || Belletristik, Sachbuch';
// |data-sort-value="" soll raus
var
i: Integer;
Pos1, Pos2: Integer;
s: string;
begin
try
Pos1 := Pos(' |data-sort-value="', derText, 1);
Pos2 := Pos(' "|', derText, Pos1 + 1) + 2;
WriteLn(derText);
s := Copy(derText, 1, Pos1);
s := s + Copy(derText, Pos2, Length(derText));
WriteLn(' ');
WriteLn(s);
ReadLn;
except
on E: Exception do
Writeln(E.ClassName, ' : ', E. Message);
end;
end.
|
|
Zitat
|