Delphi 7-如何在我的标签标题中比较值(带小数的货币),值即label 1= '12345.55‘和label 2= '12345.56',我想知道哪个值更大。
发布于 2015-07-26 11:48:13
使用SysUtils.StrToCurr()函数将标签标题转换为Currency值,然后可以使用普通算术运算符比较这些值。
Uses
SysUtils;
var
Val1, Val2: Currency;
begin
Val1 := StrToCurr(Label1.Caption);
Val2 := StrToCurr(Label2.Caption);
if Val1 > Val2 then begin
// label1 is bigger
end
else if Val1 < Val2 then begin
// label2 is bigger
end
else begin
// they are the same
end;
end;https://stackoverflow.com/questions/31633079
复制相似问题