A asdasd1211 Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-09 #1 如何取一个数字的小数点后的值,如123.456,把456取出来
千 千年冰虫 Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-09 #2 把这个数字转换为字符串.然后按小数点做为分割符进行分割...
P PFans Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-09 #3 str:=FloatToStr(123.456); subnum:=copy(str,pos('.',str)+1,length(str));
K Kang Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-09 #4 Int(X)去X的整数部分 Frac(X)去X的小数部分 这两个都是System单元的,可以直接用
L Laird Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-09 #5 procedure TForm1.Button1Click(Sender: TObject); var j, i:integer; begin j:=length(Edit1.Text); for i :=0 to j do if copy(Edit1.Text , j-i , 1) = '.' then ShowMessage( copy(edit1.Text ,j-i+1 ,i)); end;
procedure TForm1.Button1Click(Sender: TObject); var j, i:integer; begin j:=length(Edit1.Text); for i :=0 to j do if copy(Edit1.Text , j-i , 1) = '.' then ShowMessage( copy(edit1.Text ,j-i+1 ,i)); end;
B BeginDelphi Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-09 #6 IntToStr(123.456-Round(123.456)*1000)
K k10j Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-09 #7 kang的做法只是用于数学求值,frac(123.123)结果是0.123,还是PFans的做法好些。