2008-11-17 10 views

Répondre

17

Essayez la fonction de formatage.

Label1.Caption := Format('%.0n', [i + 0.0]); 
6

s: = FormatFloat ('#, ## 0', i);

-1
stringreplace(format('%n',[1234567.0]),'.00','',[]); 
-1

Format ('% n', [12345,678]);

10

Ou si vous avez besoin d'être threadsafe ou si vous voulez vous assurer que vous utilisez les paramètres régionaux par défaut du système ou si vous voulez spécifier un:

function FormatIntFromLCID(const AValue: Integer; const LCID: Integer = LOCALE_SYSTEM_DEFAULT): string; 
var 
    AFormatSettings: TFormatSettings; 
begin 
    GetLocaleFormatSettings(LCID, AFormatSettings); 
    Result := FormatFloat('#,##0',AValue, AFormatSettings); 
end; 

voir this post pour une discussion plus complète sur le formatage/locales