delpin常用函数

if  r>570 then
                 SET_TT(1);//超出多少行就用excel导出

类似数组用法:
var
       ts: TStringlist;
begin
    ts:=TStringlist.Create;
    ts.Add('select * from ...');
    ts.Sorted := True;  //需要先指定排序
      ts.Duplicates := dupIgnore;  //如有重复值则放弃存储

    if(ts.count>0) then
    begin
        for i:=0 to ts.count-1 do
        begin
           try
             adoq:=TADOQuery.Create(nil);
             adoq.Connection:=adocon;
             With adoq do
             begin
             Close;
             SQL.Clear;
             SQL.Add(ts[i]);
             if (trim(ts[i])<> '') then   
               ExecSQL;
             end;
             finally
            adoq.free;
             end;
             end;
    end;

    ts.Clear;
        ts.Free;
end;

回车换行:#13#10
字符串长度:length('21212')  

判断余数:10 mod 2

判断整数:10 div 2

循环:for i := 0 to cjstri-1 do
      begin
        //dosoming
      end;

截取字符串:copy('2311',0,2)

获取 - 的位置:var Position:integer;
              Position := Pos('-','0-5')

删除0-:Delete('0-5', 1, Position); //从第一个地方开始 删除Position个

日期格式化:FormatDateTime('yyyymm',StrToDateTime('2013-09-02'))
字符串转整形:strtoint('22');
字符串转日期:strtodate('2014-01-02');
去除空格、验证是否为空:trim(VarToStr(nvl('22','0')))

if() then
begin

end
else
begin

end;


if() then
begin

end
else if() then
begin

end;

数据库查询:
    try
      adoq:=TADOQuery.Create(nil);
      adoq.Connection:=adocon;
      With adoq do
       begin
           Close;
           SQL.Clear;
           SQL.Add(' select count(p.P_ID) as T_Count from  PI as p where p.P_SFZH='''+
           ck_ds.FieldByName('BH').AsString+
           '''   ');
           Open;
           First;
       end;
       tem:='0';
       //if  not adoq.eof then//不循环
           while (not adoq2.Eof) do //循环
        tem:=adoq.FieldByName('T_Count').AsString;
        break;//跳出
       if  strtoint(tem)<1 then
       begin
         Result:='【身份证】:'+ck_ds.FieldByName('BH').AsString+'【提示信息】:<2>【人员基础信息】数据错误 或 身份证不存在!';
       end;

    adoq.next;//循环
    finally
       adoq.free;
    end;

{*

           SETSHEET(s:integer)  //选择 Excel表格 sheet
   GET_NX(BH:人员记录号;sj:获取日期;cj:参加工作日期;tt:人员类别):integer; //获取工作年限  人员类别 10 20 30  机关 工人 事业
           TextRC(r:行;c:列;tem:填充内容); 填充vts 对应输入框内容
   GETTEXTRC //获取对应行列 对应填充内容
           Function GetItem(r:String;c:String):variant; //字典转换函数  GetItem('S_工资变动原因','75') 返回 乡镇补贴
   
           Function nvl(tem:variant;tem1:variant):variant; // nvl(tem,tem1) 如果 tem为空 则返回tem1  默认返回tem
           procedure DelRangeEx(s:integer;r1:integer;c1:integer;r2:integer;c2:integer);', CallMethod)// 清空vts 表格所选区域 所有内容以及样式格式
           fsReport.AddMethod('Function SET_TT(T_TT:integer):variant;', CallMethod);//是否为多人表格 例如九类表  0 为单模式 1 为多模式


   
          fsReport.AddMethod('function SET_BG(MaxV:integer;PT:String):Variant;', CallMethod); //多人模式下进度条
          fsReport.AddMethod('function SET_BGV(VV:integer):Variant;', CallMethod);


          fsReport.AddMethod('procedure FaRC(r:integer;c:integer;tem:variant);', CallMethod); // 同 TextRC  只是当前函数 填充的是 函数 例如 合计等方法
           GetFaRC  //获取当前输入框 函数
           FV_C_R  // ts 显示的最大行列

原文地址:https://www.cnblogs.com/shuzhenzhumo/p/5513070.html