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

       五.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);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值