The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Declaration:function Decimal (innum: longint; places: byte): string;

The function Decimal converts the integer number innum to an ASCII string which is the decimal representation of that number but the leading spaces replaced by zeros. The number is written with a variable number of places, which can be defined by the parameter places (1..255). A negative number will be displayed with a leading '-' character, thus increasing the number characters output by one.

Hint: If the value of the parameter places is less than one the value is automatically restricted to 1. If places does not suffice to display the decimal representation, the resulting string is truncated.

Example: write (Decimal (2334,8)); writes the number 2334 using decimal notation with 8 characters and leading zeros ('00002334');

Example: This procedure is used in the following example program (see for downloading the code): slides

Last Update: 2012-Okt-20