反向FloatToStrF结果

时间:2013-10-10 17:20:33

标签: delphi formatting delphi-2010 currency

是否有反转FloatToStrF的功能?我的意思是从货币货币格式回到字符串格式。例如:

Edit1.Text := FloatToStrF(10000, ffCurrency, 15, 4);

结果

Edit1.Text = '$10,000.0000'

我想知道是否有像StrToFloatF那样的东西

Edit1.Text = '10000';

感谢的

1 个答案:

答案 0 :(得分:2)

怎么样:

function RemoveAnythingButNumbers(aString: string): string;
var
  C: Char;
begin
  Result := '';
  for C in aString do
  begin
    if C in ['0'..'9'] then Result := Result + C;
  end;
end;

请注意,我更正了一组数字。