Int2EStr Routines
Converts an Integer into a string without Padding.

Unit
QESBPCSConvert

Overloaded Variants
Function Int2EStr(const L: LongInt): string;
Function Int2EStr(const L: Int64): string;

Declaration
Function Int2EStr(const L: LongInt): 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 an Empty string.

Parameters
Value to Convert to String.

Category
String/Integer Conversion Routines

Implementation

function Int2EStr (const L: LongInt): string;
begin
     if ESBBlankWhenZero and (L = 0) then
     begin
          Result := '';
          Exit;
     end;

     try
          FmtStr (Result, '%d', [L]); // Format the string
          if ESBNumPosSign and (L > 0) then // See if '+' needed
               Result := '+' + Result;
     except
          Result := '';
     end;
End;

Declaration
Function Int2EStr(const L: Int64): string;

Implementation

function Int2EStr (const L: Int64): string;
begin
     if ESBBlankWhenZero and (L = 0) then
     begin
          Result := '';
          Exit;
     end;

     try
          FmtStr (Result, '%d', [L]); // Format the string
          if ESBNumPosSign and (L > 0) then // See if '+' needed
               Result := '+' + Result;
     except
          Result := '';
     end;
End;


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