Converts a Float into a string without Padding.Unit
QESBPCSConvert
Declaration
Function Float2EStr(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 Float2EStr2, Float2Str & Float2CEStr
X | Value to Convert to String. |
Decimals | is the desired number of Decimal places, defaults to 4 |
Category
String/Float Conversion Routines
Implementation
function Float2EStr (const X: Extended; const Decimals: Byte = 4): string;
begin
if ESBBlankWhenZero and FloatIsZero (X) then
begin
Result := '';
Exit;
end;
try
Result := FloatToStrF (X, ffFixed, 18, Decimals);
if ESBNumPosSign and (X > 0) then // See if '+' needed
Result := '+' + Result;
except
Result := '';
end;
End; |
Declaration
Function Float2EStr(const X: Double; const Decimals: Byte = 4): string;Implementation
function Float2EStr (const X: Double; const Decimals: Byte = 4): string;
begin
if ESBBlankWhenZero and FloatIsZero (X) then
begin
Result := '';
Exit;
end;
try
Result := FloatToStrF (X, ffFixed, 15, Decimals);
if ESBNumPosSign and (X > 0) then // See if '+' needed
Result := '+' + Result;
except
Result := '';
end;
End; |
Declaration
Function Float2EStr(const X: Single; const Decimals: Byte = 4): string;Implementation
function Float2EStr (const X: Single; const Decimals: Byte = 4): string;
begin
if ESBBlankWhenZero and FloatIsZero (X) then
begin
Result := '';
Exit;
end;
try
Result := FloatToStrF (X, ffFixed, 7, Decimals);
if ESBNumPosSign and (X > 0) then // See if '+' needed
Result := '+' + Result;
except
Result := '';
end;
End; |
HTML generated by Time2HELP
|
http://www.time2help.com