Int2CStr Routines
Converts an Integer into a string of length Len with ESBNumPadCh Padding and with ThousandSeparators as defined in the Regional Settings.

Unit
QESBPCSConvert

Overloaded Variants
Function Int2CStr(const L: LongInt; const Len: Byte): string;
Function Int2CStr(const L: Int64; const Len: Byte): string;

Declaration
Function Int2CStr(const L: LongInt; const Len: Byte): string;

Description
ESBNumPosSign controls whether a '+' Sign appears at the beginning for positive Integers. ESBBlankWhenZero can be set to True to have Zero returned as a string of blanks.

Parameters
Value to Convert to String.
Len is the length of the resultant string. If it is too small then valid digits will be truncated from the right.

Category
String/Integer Conversion Routines

Implementation

function Int2CStr (const L: LongInt; const Len: Byte): string;
begin
     if ESBBlankWhenZero and (L = 0) then
     begin
          Result := BlankStr (Len);
          Exit;
     end;

     Result := PadChLeftStr (LeftStr (Int2CEStr (L), Len), ESBNumPadCh, Len);
End;

Declaration
Function Int2CStr(const L: Int64; const Len: Byte): string;

Implementation

function Int2CStr (const L: Int64; const Len: Byte): string;
begin
     if ESBBlankWhenZero and (L = 0) then
     begin
          Result := BlankStr (Len);
          Exit;
     end;

     Result := PadChLeftStr (LeftStr (Int2CEStr (L), Len), ESBNumPadCh, Len);
End;


HTML generated by Time2HELP
http://www.time2help.com