Navigation: Function Reference > General Utility Functions > format()

format()

Top  Previous  Next

format( formatting: String; data: array of const ) : String;

 

Returns one or more data types as a string. Available data type indicators are:

 

d = decimal

e = scientific

f = fixed

g = general

m = money

n = number (floating point)

p = pointer

s = string

u = unsigned decimal

x = hexadecimal

 

 

Parameters

 

formatting

string value representing the format

data

array of values to be formatted

 

s := format( 'integer: %d floating point number: %2.4f', [5,2.345] );

 

debugPrint(Format('Decimal = %d', [-123]));
debugPrint(Format('Exponent = %e', [12345.678]));
debugPrint(Format('Fixed = %f', [12345.678]));
debugPrint(Format('General = %g', [12345.678]));
debugPrint(Format('Number = %n', [12345.678]));
debugPrint(Format('Money = %m', [12345.678]));
debugPrint(Format('Pointer = %p', [addr(text)]));
debugPrint(Format('String = %s', ['Hello']));
debugPrint(Format('Unsigned decimal = %u', [123]));
debugPrint(Format('Hexadecimal = %x', [140]));
 

See Also:

 

debugPrint()