打印本文 打印本文 关闭窗口 关闭窗口
Delphi 函数参考
作者:武汉SEO闵涛  文章来源:敏韬网  点击数7312  更新时间:2009/4/23 18:27:19  文章录入:mintao  责任编辑:mintao
p;  首部 function FloatToStr(Value: Extended): string; $[SysUtils.pas
      功能 返回浮点数Value转换成字符串
      说明 当浮点数大等于1E15将采用科学记数法
      参考 function SysUtils.FloatToText
      例子 Edit1.Text := FloatToStr(Now);
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function CurrToStr(Value: Currency): string; $[SysUtils.pas
      功能 返回货币数Value转换成字符串
      说明 货币数只保留四位小数
      参考 function SysUtils.FloatToText
      例子 Edit1.Text := CurrToStr(Now);
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function FloatToCurr(const Value: Extended): Currency; $[SysUtils.pas
      功能 返回浮点数Value转换成货币数
      说明 如果浮点数Value超出范围则将触发异常
      参考 const SysUtiles.MinCurrency;const SysUtiles.MaxCurrency
      例子 Edit1.Text := CurrToStr(FloatToCurr(Now));
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision,
      Digits: Integer): string; $[SysUtils.pas
      功能 返回浮点数以指定格式转换成字符串
      说明 Precision指定精度;Digits指定小数宽度
      参考 function SysUtils.FloatToText
      例子
      ///////Begin FloatToStrF
      procedure TForm1.Button1Click(Sender: TObject);
      begin
      Memo1.Lines.Values[''''ffGeneral''''] := FloatToStrF(StrToFloatDef(Edit1.Text,
      0),
      ffGeneral, SpinEdit1.Value, SpinEdit2.Value);
      Memo1.Lines.Values[''''ffExponent''''] := FloatToStrF(StrToFloatDef(Edit1.Text,
      0),
      ffExponent, SpinEdit1.Value, SpinEdit2.Value);
      Memo1.Lines.Values[''''ffFixed''''] := FloatToStrF(StrToFloatDef(Edit1.Text, 0),
      ffFixed, SpinEdit1.Value, SpinEdit2.Value);
      Memo1.Lines.Values[''''ffNumber''''] := FloatToStrF(StrToFloatDef(Edit1.Text,
0),
      ffNumber, SpinEdit1.Value, SpinEdit2.Value);
      Memo1.Lines.Values[''''ffCurrency''''] := FloatToStrF(StrToFloatDef(Edit1.Text,
      0),
      ffCurrency, SpinEdit1.Value, SpinEdit2.Value);
      end;
      ///////End FloatToStrF
      ━━━━━━━━━━━━━━━━━━━━━
      首部 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(
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function FormatFloat(const Format: string; Value: Extended): string;
      $[SysUtils.pas
      功能 返回浮点数类型以指定格式字符串Format转换成字符串
      说明 FormatFloat('''',.00'''', 1234567890) = ''''1,234,567,890.00''''
      参考 function SysUtils.FloatToTextFmt
      例子 Edit1.Text := FormatFloat(Edit2.Text, StrToFloatDef(Edit3.Text, 0));
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function FormatCurr(const Format: string; Value: Currency): string;
      $[SysUtils.pas
      功能 返回货币类型以指定格式字符串Format转换成字符串
      说明 FormatCurr('''',.00'''', 1234567890) = ''''1,234,567,890.00''''
      参考 function SysUtils.FloatToTextFmt
      例子 Edit1.Text := FormatCurr(Edit2.Text, StrToCurrDef(Edit3.Text, 0));
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function FloatToTextFmt(Buf: PChar; const Value; ValueType:
      TFloatValue; Format: PChar): Integer; $[SysUtils.pas
      功能 返回浮点数以指定格式字符串Format转换成指针字符串的内存大小
      说明 ValueType指定无类型参数Value的类型
      参考 <NULL>
      例子
      ///////Begin FloatToTextFmt
      procedure TForm1.Button1Click(Sender: TObject);
      var
      vBuffer: array[0..255] of Char;
      E: Extended;
      begin
      E := StrToFloatDef(Edit1.Text, 0);
      SpinEdit1.Value := FloatToTextFmt(vBuffer, E,
      fvExtended, PChar(Edit2.Text));
      Edit3.Text := Copy(vBuffer, 1, SpinEdit1.Value);
      end;
      ///////End FloatToTextFmt
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function StrToFloat(const S: string): Extended; $[SysUtils.pas
      功能 返回字符串S转换成浮点数
      说明 字符串非浮点数表达时将引起异常
      参考 function SysUtils.TextToFloat
      例子 var E: Extended; begin E := StrToFloat(Edit1.Text); end;
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function StrToFloatDef(const S: string; const Default: Extended):
      Extended; $[SysUtils.pas
      功能 返回字符串S转换成浮点数
      说明 字符串非浮点数表达时则返回默认值Default
      参考 function SysUtils.TextToFloat
      例子 var E: Extended; begin E := StrToFloatDef(Edit1.Text, 0); end;
      ━━━━━━━━━━━━━━━━━━━━━
      首部 function TryStrToFloat(const S: string; out Value: Extended): Boolean;
      overload; $[SysUtils.pas
      首部 function TryStrToFloat(const S: string; out Value: Single): Boolean;
      overload; $[SysUtils.pas
      首部 function TryStrToFloat(const S: string; out Value: Double): Boolean;
      overload; $[SysUtils.pas
      功能 返回字符串S转换成浮点数Value是否成功
      说明 字符串非浮点数表达时返回False并且Value将输出为不确定的值
      参考 function SysUtils.TextToFloat
      例子
      ///////Begin TryStrToFloat
      procedure TForm1.Button1Click(S

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ...  下一页 >> 

打印本文 打印本文 关闭窗口 关闭窗口