removing leading zeros from delphi string

function removeLeadingZeros(const Value: string): string;
var
  i: Integer;
begin
  for i := 1 to Length(Value) do
    if Value[i]<>'0' then
    begin
      Result := Copy(Value, i, MaxInt);
      exit;
    end;
  Result := '';
end;

Depending on the exact requirements you may wish to trim whitespace. I have not done that here since it was not mentioned in the question.

Update

I fixed the bug that Serg identified in the original version of this answer.


Probably not the fastest one, but it's a one-liner ;-)

function RemoveLeadingZeros(const aValue: String): String;
begin
  Result := IntToStr(StrToIntDef(aValue,0));
end;

Only works for numbers within the Integer range, of course.


Code that removes leading zeroes from '000'-like strings correctly:

function TrimLeadingZeros(const S: string): string;
var
  I, L: Integer;
begin
  L:= Length(S);
  I:= 1;
  while (I < L) and (S[I] = '0') do Inc(I);
  Result:= Copy(S, I);
end;

Use JEDI Code Library to do this:

uses JclStrings;

var
  S: string;

begin
  S := StrTrimCharLeft('00000004357816', '0');
end.