Delphi-Quellcode:
i:=0;
if length(mystring)>0 then begin
repeat
if mystring[i+1]<>'0' then inc (i,1);
until (mystring[i+1]<>'0') or (i>=length(mystring));
if i>0 then delete(mystring,1,i);
end;
Das führt bei mir zu einer Endlos-Schleife, aber so klappts:
Delphi-Quellcode:
function DelLeadChar(const Input: string; const LeadChar: Char): string;
var
i: Integer;
begin
i:=0;
Result := Input;
if length(Input)>0 then
begin
repeat
if Input[i+1]=LeadChar then inc (i,1);
// if Input[i+1]<>LeadChar then inc (i,1); // nicht gut ^_^
until (Input[i+1]<>LeadChar) or (i>=length(Input));
if i>0 then delete(Result,1,i);
end;
end;