Converts a Float into a string in Scientific Notation of length Len with ESBNumPadCh Padding to the Left.Unit
QESBPCSConvert
Declaration
Function SciFloat2Str(const X: Extended; const Len: Byte; const Decimals: Byte = 4): string;
Description
This is of the form d.dddEnn. ESBBlankWhenZero can be set to True to have Zero returned as an Empty string, where Zero is dependent upon ESBTolerance.
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 SciFloat2Str (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 (SciFloat2EStr (X, Decimals), Len), ESBNumPadCh, Len);
End; |
Declaration
Function SciFloat2Str(const X: Double; const Len: Byte; const Decimals: Byte = 4): string;Implementation
function SciFloat2Str (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 (SciFloat2EStr (X, Decimals), Len), ESBNumPadCh, Len);
End; |
Declaration
Function SciFloat2Str(const X: Single; const Len: Byte; const Decimals: Byte = 4): string;Implementation
function SciFloat2Str (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 (SciFloat2EStr (X, Decimals), Len), ESBNumPadCh, Len);
End; |
HTML generated by Time2HELP
|
http://www.time2help.com