Bom dia a todos...

A seguinte função recebe um currency e
retorna uma string conforme o tamanho indicado
e duas casas decimais separadas por vírgula

function FormatarCurr2D( Value: Currency; MaxLength: integer): string;
begin
  Result := FormatCurr(StringOfChar('0', MaxLength - 4) + '0.00', Value);
  Result := StringReplace(Result, '.', ',', [rfReplaceAll]);
end;

Ex: FormatarCurr2D( 123.45, 15) > retorna '000000000123,45'

Tô achando feio esse código! Tem como fazer melhor??

Obrigado

Responder a