从delphi字符串中删除前导零

德尔福7

如何删除delphi字符串中的前导零?

例:

00000004357816

function removeLeadingZeros(ValueStr: String): String
begin
 result:= 
end;

解决方法

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;

根据具体要求,您可能希望修剪空白.我没有这样做,因为这个问题没有提到.

更新

我修复了Serg在原始版本中确定的错误.

相关文章

 从网上看到《Delphi API HOOK完全说明》这篇文章,基本上都...
  从网上看到《Delphi API HOOK完全说明》这篇文章,基本上...
ffmpeg 是一套强大的开源的多媒体库 一般都是用 c/c+&#x...
32位CPU所含有的寄存器有:4个数据寄存器(EAX、EBX、ECX和ED...
1 mov dst, src dst是目的操作数,src是源操作数,指令实现的...