当前位置:编程学习 > Delphi >>

Delphi6函数大全(12)

首部 function CurrToStrF(Value: Currency; Format: TFloatFormat; Digits: Integer): string; $[SysUtils.pas
功能 返回货币类型以指定格式转换成字符串
说明 Digits指定小数宽度
参考 function SysUtils.FloatToText

例子
///////Begin CurrToStrF
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines.Values[ffGeneral] := CurrToStrF(StrToCurrDef(Edit1.Text, 0),
ffGeneral, SpinEdit1.Value);
Memo1.Lines.Values[ffExponent] := CurrToStrF(StrToCurrDef(Edit1.Text, 0),
ffExponent, SpinEdit1.Value);
Memo1.Lines.Values[ffFixed] := CurrToStrF(StrToCurrDef(Edit1.Text, 0),
ffFixed, SpinEdit1.Value);
Memo1.Lines.Values[ffNumber] := CurrToStrF(StrToCurrDef(Edit1.Text, 0),
ffNumber, SpinEdit1.Value);
Memo1.Lines.Values[ffCurrency] := CurrToStrF(StrToCurrDef(Edit1.Text, 0),
ffCurrency, SpinEdit1.Value);
end;
///////End CurrToStrF
━━━━━━━━━━━━━━━━━━━━━
首部 function FloatToText(BufferArg: PChar; const Value; ValueType: TFloatValue; Format: TFloatFormat; Precision, Digits: Integer): Integer; $[SysUtils.pas
功能 返回浮点数以指定格式转换成指针字符串的内存大小
说明 Precision指定精度;Digits指定小数宽度
参考 <NULL>
例子
///////Begin FloatToText
procedure TForm1.Button1Click(Sender: TObject);
var
vBuffer: array[0..255] of Char;
E: Extended;
begin
E := StrToFloatDef(Edit1.Text, 0);
SpinEdit3.Value := FloatToText(vBuffer, E,
fvExtended, ffNumber, SpinEdit1.Value, SpinEdit2.Value);
Edit2.Text := Copy(vBuffer, 1, SpinEdit3.Value);
end;
///////End FloatToText(
补充:软件开发 , Delphi ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,