git-svn-id: https://192.168.0.254/svn/Proyectos.AlonsoYSal_FactuGES2/trunk@6 40301925-124e-1c4e-b97d-170ad7a8785b
40 lines
907 B
ObjectPascal
40 lines
907 B
ObjectPascal
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
|
|
JclAnsiStrings, cxVariants;
|
|
|
|
function CompararReferencias(const ARef1, ARef2 : String) : Integer;
|
|
var
|
|
Aux1, Aux2 : String;
|
|
AuxInt1, AuxInt2: Double;
|
|
Rpl : Char;
|
|
begin
|
|
Rpl := ' ';
|
|
Aux1 := StrReplaceButChars(ARef1, AnsiDecDigits, Rpl);
|
|
Aux1 := StrRemoveChars(Aux1, AnsiWhiteSpace);
|
|
Aux2 := StrReplaceButChars(ARef2, AnsiDecDigits, Rpl);
|
|
Aux2 := StrRemoveChars(Aux2, AnsiWhiteSpace);
|
|
|
|
if StrIsDigit(Aux1) and StrIsDigit(Aux2) then
|
|
begin
|
|
AuxInt1 := StrToFloatSafe(Aux1);
|
|
AuxInt2 := StrToFloatSafe(Aux2);
|
|
Result := VarCompare(AuxInt1, AuxInt2)
|
|
end
|
|
else
|
|
Result := VarCompare(Aux1, Aux2)
|
|
end;
|
|
|
|
end.
|