2008-06-03 11:27:19 +00:00
|
|
|
unit uReferenciasUtils;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ Si ARef1 < ARef2 -> Result := -1
|
|
|
|
|
Si ARef1 = ARef2 -> Result := 0
|
|
|
|
|
Si ARef1 > ARef2 -> Result := 1 }
|
|
|
|
|
|
|
|
|
|
function CompararReferencias(const ARef1, ARef2 : String) : Integer;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses
|
2009-03-05 12:18:48 +00:00
|
|
|
JclAnsiStrings, cxVariants;
|
2008-06-03 11:27:19 +00:00
|
|
|
|
|
|
|
|
function CompararReferencias(const ARef1, ARef2 : String) : Integer;
|
|
|
|
|
var
|
|
|
|
|
Aux1, Aux2 : String;
|
2008-10-31 18:16:49 +00:00
|
|
|
AuxInt1, AuxInt2: Double;
|
2008-06-03 11:27:19 +00:00
|
|
|
Rpl : Char;
|
|
|
|
|
begin
|
2008-10-03 11:43:27 +00:00
|
|
|
Rpl := ' ';
|
2008-06-03 11:27:19 +00:00
|
|
|
Aux1 := StrReplaceButChars(ARef1, AnsiDecDigits, Rpl);
|
2008-10-03 11:43:27 +00:00
|
|
|
Aux1 := StrRemoveChars(Aux1, AnsiWhiteSpace);
|
2008-06-03 11:27:19 +00:00
|
|
|
Aux2 := StrReplaceButChars(ARef2, AnsiDecDigits, Rpl);
|
2008-10-31 18:16:49 +00:00
|
|
|
Aux2 := StrRemoveChars(Aux2, AnsiWhiteSpace);
|
2008-06-03 11:27:19 +00:00
|
|
|
|
|
|
|
|
if StrIsDigit(Aux1) and StrIsDigit(Aux2) then
|
2008-10-31 18:16:49 +00:00
|
|
|
begin
|
|
|
|
|
AuxInt1 := StrToFloatSafe(Aux1);
|
|
|
|
|
AuxInt2 := StrToFloatSafe(Aux2);
|
|
|
|
|
Result := VarCompare(AuxInt1, AuxInt2)
|
|
|
|
|
end
|
2008-06-03 11:27:19 +00:00
|
|
|
else
|
2008-07-31 15:48:01 +00:00
|
|
|
Result := VarCompare(Aux1, Aux2)
|
2008-06-03 11:27:19 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|