Float2EStr2 Routines
Like Float2EStr this ccnverts a Float into a string without Padding, except this removes all trailing 0's and the decimal separator if not needed.

Unit
QESBPCSConvert

Overloaded Variants
Function Float2EStr2(const X: Extended; const Decimals: Byte = 4): string;
Function Float2EStr2(const X: Double; const Decimals: Byte = 4): string;
Function Float2EStr2(const X: Single; const Decimals: Byte = 4): string;

Declaration
Function Float2EStr2(const X: Extended; const Decimals: Byte = 4): 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, where Zero is dependent upon ESBTolerance. Also see Float2EStr, Float2Str & Float2CEStr

Parameters
Value to Convert to String.
Decimals is the desired number of Decimal places, defaults to 4

Category
String/Float Conversion Routines

Implementation

function Float2EStr2 (const X: Extended; const Decimals: Byte = 4): string;
begin
     Result := StripTChStr (Float2EStr (X, Decimals), '0');
     if Result [Length (Result)] = '.' then
          Result := LeftStr (Result, Length (Result) - 1);
End;

Declaration
Function Float2EStr2(const X: Double; const Decimals: Byte = 4): string;

Implementation

function Float2EStr2 (const X: Double; const Decimals: Byte = 4): string;
begin
     Result := StripTChStr (Float2EStr (X, Decimals), '0');
     if Result [Length (Result)] = '.' then
          Result := LeftStr (Result, Length (Result) - 1);
End;

Declaration
Function Float2EStr2(const X: Single; const Decimals: Byte = 4): string;

Implementation

function Float2EStr2 (const X: Single; const Decimals: Byte = 4): string;
begin
     Result := StripTChStr (Float2EStr (X, Decimals), '0');
     if Result [Length (Result)] = '.' then
          Result := LeftStr (Result, Length (Result) - 1);
End;


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