Format - exemplos |
Top Previous Next |
STRING ------ 'Meu nome é ' + sName + ' e eu tenho ' + IntToStr( 16 ) + ' anos'
Exemplo com o Format: ---------------------
Format('Meu nome é %s e eu tenho %d anos', [ sName, 16 ] )
-------------------- numeros --------------------
Format( formato, [12345.6789] );
formato result explain --------- ---------------- --------------- %f '12345,68' float %m 'R$ 12.345,68' money %n '12.345,68' numeric (equal float but thousand sep) %8.2f '12345,68' float with width 8 and 2 decimals %8.3f '12345,679' float with width 8 and 3 decimals %10.1f ' 12345,7' float with width 10 and 1 decimal %-10.1f '12345,7 ' float with width 10 and 1 decimal left align %8.2n '12.345,68' numeric with width 8 and 2 decimals %12.2n ' 12.345,68' numeric with width 12 and 2 decimals %-12.2n '12.345,68 ' numeric with width 12 and 2 decimals left align %13.2m ' R$ 12.345,68' money with width 13 and 2 decimals
HEXA: ----- Format( '%h' , [32] ) = '20' Format( '%4h' , [32] ) = ' 20' Format( '%-4x', [32] ) = '20 ' |