Converts a Float into a string of length Len with ESBNumPadCh Padding to the Left.Unit
QESBPCSConvert
Declaration
Function Float2Str(const X: Extended; const Len: Byte; 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, Float2CStr & Float2ZStr
X | 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. |
Decimals | is the desired number of Decimal places, defaults to 4 |
Category
String/Float Conversion Routines
Implementation
function Float2Str (const X: Extended; const Len: Byte;
const Decimals: Byte = 4): string;
begin
if ESBBlankWhenZero and FloatIsZero (X) then
begin
Result := BlankStr (Len);
Exit;
end;
Result := PadChLeftStr (LeftStr (Float2EStr (X, Decimals), Len), ESBNumPadCh, Len);
End; |
Declaration
Function Float2Str(const X: Double; const Len: Byte; const Decimals: Byte = 4): string;Implementation
function Float2Str (const X: Double; const Len: Byte;
const Decimals: Byte = 4): string;
begin
if ESBBlankWhenZero and FloatIsZero (X) then
begin
Result := BlankStr (Len);
Exit;
end;
Result := PadChLeftStr (LeftStr (Float2EStr (X, Decimals), Len), ESBNumPadCh, Len);
End; |
Declaration
Function Float2Str(const X: Single; const Len: Byte; const Decimals: Byte = 4): string;Implementation
function Float2Str (const X: Single; const Len: Byte;
const Decimals: Byte = 4): string;
begin
if ESBBlankWhenZero and FloatIsZero (X) then
begin
Result := BlankStr (Len);
Exit;
end;
Result := PadChLeftStr (LeftStr (Float2EStr (X, Decimals), Len), ESBNumPadCh, Len);
End; |
HTML generated by Time2HELP
|
http://www.time2help.com