n间隔四舍六入
function TmainForm.tysswr(n,i:integer;s:string):string; //n间隔四舍六入 var temp:real; t:string; begin temp:=strtofloat(s)/n; t:=mainForm.sswr(floattostr(temp),i); temp:=strtofloat(t)*n; t:=mainForm.sswr(floattostr(temp),i); result:=t; end;[@more@]
计算两个日期间有多少个工作日
function TmainForm.WorksDay( //计算两个日期间有多少个工作日 mStartDate: TDate; //开始日期 mEndDate: TDate //终止日期 ): Integer; //返回两个日期间的工作日,如果输入错误则返回-1 var m,n:integer; begin Result := -1; if mEndDate < mStartDate then Exit; m:=DaysBetween(mStartDate,mEndDate); n:=(m div 7)*2; if m mod 7<>0 then begin if DayOfWeek(mStartDate)>DayOfWeek(m
delphi四舍六入函数
function TmainForm.sswr(s:string;i:integer):string;var str,str20,temp,temp0,temp1,r:string;beginstr:=s;str20:=copy(str,pos('.',str)+1,length(str));//showmessage(str20);temp:=copy(str20,i+1,1);temp0:=copy(str20,i,1);temp1:=copy(str20,i+2,length(str20));if ((length(str20)<=i)and(length(str20)>0 )) thenbeginr:=str+'00000000000';r:=copy(r,1,pos('.',str)+i);end elseif (length(temp1)=0 )and (strtoint(temp)=5 ) and (strtoint(temp0)mod 2=0) thenbeginr:=copy(str,1,pos('.',str)+i);end elsebeginif i=