本文整理自网络,侵删。
自己建立一个Button1按钮
procedure TForm1.Button1Click(Sender: TObject);
var
S, T: string;
begin
Str(1.4:2:1, T); //用Str转换了T的格式
S := T + ' Truncs to ' + IntToStr(Trunc(1.4)) + #13#10; //回车加换行
Str(1.5:2:1, T);
S := S + T + ' Truncs to ' + IntToStr(Trunc(1.5)) + #13#10; //S不断叠加
Str(-1.4:2:1, T);
S := S + T + ' Truncs to ' + IntToStr(Trunc(-1.4)) + #13#10; //TrunC转换函数
Str(-1.5:2:1, T);
S := S + T + ' Truncs to ' + IntToStr(Trunc(-1.5)); //TrunC把小数点后面的全去掉了.
MessageDlg(S, mtInformation, [mbOk], 0);
end; 相关阅读 >>
Delphi 双击listbox1内容,数据插入到memo1/synedit1鼠标指定位置
Delphi isleapyear、isinleapyear - 是否是闰年
Delphi tmemo控件滚动条scrollbar末尾插入字符串一点都会闪烁的轻松实现
更多相关阅读请进入《Delphi》频道 >>