C++ Builder VCL库函数简介(3)

来源:互联网 发布:如何晒单淘宝 编辑:程序博客网 时间:2024/05/29 16:55
       五.Borland C++ Builder VCL的数值转换函数

  1. IntToStr
  将整数转换为AnsiString字符串,函数原型如下:
  AnsiString __fastcall IntToStr(int Value);

  2. IntToHex
  将整数转换为十六进制字符串,函数原型如下:
  AnsiString __fastcall IntToHex(int Value, int Digits);

  3. StrToInt
  将AnsiString字符串转换为整数值,如果不能进行转换,则产生EConvertError异常,
  函数原型如下:
  int __fastcall StrToInt(const AnsiString S);

  4. StrToIntDef
  将AnsiString字符串转换为一个数值,函数原型如下:
  int __fastcall StrToIntDef(const System::AnsiString S,int Default);

  5. FloatToStr
  将浮点数转换为AnsiString字符串,函数原型如下:
  AnsiString __fastcall FloatToStr(Extended Value);

  6. StrToFloat
  将AnsiString字符串转换为一个浮点数值,函数原型如下:
  Extended __fastcall StrToFloat(const AnsiString S);

  7. FloatToStrF
  将浮点数转换为指定格式的AnsiString字符串,函数原型如下:
  AnsiString __fastcall FloatToStrF(Extended Value, TFloatFormat Format,int Precision, int Digits);

  六.Borland C++ Builder VCL的时间函数

  1. Date
  返回TDateTime对象,包含当前的年月日信息,函数原型如下:
  System::TDateTime __fastcall Date(void);

  2. Time
  返回TDateTime对象,包含当前的时间信息,函数原型如下:
  System::TDateTime __fastcall Time(void);

  3. Now
  返回TDateTime对象,获取当前的日期和时间信息,函数原型如下:
  System::TDateTime __fastcall Now(void);

  4. DatetimeToString
  将TDateTime对象转换为指定格式的字符串对象,函数原型如下:
  void __fastcall DateTimeToString(AnsiString &;Result, const AnsiString Format,System::TDateTime DateTime);

  5. DateToStr
  将TDateTime对象(包含当前年月日信息)转换为字符串对象,函数原型如下:
  AnsiString __fastcall DateToStr(System::TDateTime Date);

  6. TimeToStr
  将当前日期转换为字符串对象,函数原型如下:
  AnsiString __fastcall TimeToStr(System::TDateTime Time);

  7. DateTimetoStr
  将TDateTime对象转换为字符串对象,函数原型如下:
  AnsiString __fastcall DateTimeToStr(System::TDateTime DateTime);

  8. StrToDate
  将字符串对象转换为年月日对象,函数原型如下:
  System::TDateTime __fastcall StrToDate(const AnsiString S);

  9. StrToTime
  将字符串对象转换时间对象,函数原型如下:
  System::TDateTime __fastcall StrToTime(const AnsiString S);

  10.StrToDateTime
  将字符串对象转换为年月日时间对象,函数原型如下:
  System::TDateTime __fastcall StrToDateTime(const AnsiString S);

  11.DateTimeToSystemTime
  将TDateTime对象转换为操作系统时间,函数原型如下:
  void __fastcall DateTimeToSystemTime(System::TDateTime DateTime, _SYSTEMTIME &;SystemTime);

  12.SystemTimeToDateTime
  将操作系统时间转换为TDateTime对象,函数原型如下:
  System::TDateTime __fastcall SystemTimeToDateTime(const _SYSTEMTIME &;SystemTime);