result := ainteger;
end;
class function tinteger.inttostr(ainteger: int64): string;
begin
result := sysutils.inttostr(ainteger);
end;
class function tinteger.isvalidint(astring: string): boolean;
begin
result := true;
try
strtoint(astring);
except
result := false;
end;
end;
class function tinteger.isvalidint64(astring: string): boolean;
begin
result := true;
try
strtoint(astring);
except
result := false;
end;
end;
class function tinteger.maxint: integer;
begin
result := system.maxint;
end;
class function tinteger.maxlongint: integer;
begin
result := system.maxlongint;
end;
class function tinteger.inttobin(ainteger: cardinal): string;
var
i: integer;
begin
setlength(result, 32);
for i := 1 to 32 do
begin
if ((ainteger shl (i-1)) shr 31) = 0 then
result[i] := '0'
else
result[i] := '1';
end;
end;
class function tinteger.inttohex(ainteger: integer): string;
begin
result := sysutils.inttohex(ainteger, 0);
end;
class function tinteger.hextoint(astring: string): integer;
begin
if tstring.left(astring, 1) = '$' then
result := strtoint(astring)
else
result := strtoint('$' + astring);
end;
class function tinteger.makeserialno(ainteger, adigit: integer): string;
var
tmpstr: string;
i: integer;
begin
tmpstr := '';
for i := 0 to adigit - 1 do // iterate
begin
tmpstr := tmpstr + '0';
end; // for
result := formatfloat(tmpstr, ainteger);
end;
{ tfloat }
class function tfloat.floattomoney(const value: double; round: boolean): string;
begin
//金额默认采用四舍五入
end;
class function tfloat.isvalidfloat(astring: string): boolean;
begin
result := true;
try
strtofloat(astring);
except
result := false;
end;
end;
class function tfloat.maxdouble: double;
begin
result := 1.7e+308;
end;
class function tfloat.maxextended: extended;
begin
result := 1.1e+4932;
end;
class function tfloat.mindouble: double;
begin
result := 5.0e-324;
end;
class function tfloat.minextended: extended;
begin
result := 3.4e-4932;
end;
class function tfloat.samevalue(const a, b: single;
epsilon: single): boolean;
begin
result := math.samevalue(a, b, epsilon);
end;
class function tfloat.samevalue(const a, b: double;
epsilon: double): boolean;
begin
result := math.samevalue(a, b, epsilon);
end;
class function tfloat.samevalue(const a, b: extended;
epsilon: extended): boolean;
begin
result := math.samevalue(a, b, epsilon);
end;
{ tboolean }
class function tboolean.booltostr(aboolean: boolean): string;
begin
if aboolean then
result := 'true'
else
result := 'false';
end;
class function tboolean.strtobool(astring: string): boolean;
begin
if uppercase(astring) = 'true' then
result := true
else
result := false;
end;
end.