C Builder语法

基本数据类型

String& Delete(int index, int count); //删除第index开始的nCount个字符
int Pos(Const AnsiStringT& subStr) const //查找子串
static String IntToHex(int value, int digits); //把整数转换为16进制字符串
static String FormatFloat(const String& format, const long double &value); //浮点数格式化输出字符串
AnsiString成员函数
int AnsiPos(const AnsiStringT& subStr) const; //查找子串,(中文使用?)
int AnsiCompare(const AnsiStringT& rhs) const //比较字符串大小

UnicodeString成员函数
AnsiString
char* c_str(); //返回NULL结尾的字符串指针
AnsiString& Delete(int index, int count);
double ToDouble() const;
int ToInt()const;

常用属性:

Open_Ini_File(ExtractFilePath(Application->ExeName)+Fru_Model);
DirectoryExists(Dir_name);

常用函数

#include <vcl.h>
ShowMessage("ces");     //弹出对话框

常用方法

TextBuf.sprintf("%c",FRU_Data[Name_Address+i]);

常用控件

StringGrid

stringGrid->ColCount = 6;   //设置总列数
stringGrid->RowCount = 4;   //总行数
//表头
stringGrid->FixedCols = 0;  //资料区列数
stringGrid->FixedRows = 1;  //资料区行数

stringGrid->Cells[0][0] = "显示的内容";
stringGrid->Color = clBlue;
stringGrid->FixedColor = clYellow;

数据类型转换

editRes->Text = FormatFloat("0.00", dRes);     //格式化输出
String str = FormatFloat("#,##0.00", dRes);

AnsiString RevStr;
char* Rev = RevStr.c_str();
FRU_Data[Rev_Address+i] = RevStr.c_str()[i];

String str;
Edit1->Text = str.sprintf(L"%d:%.2f", 10, 1.235);

String sTime = FormatDateTime("yyyy-mm-dd", Now());         //日期时间
String sTime = Now().FormatString("HH:MM:SS");
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值