git-svn-id: https://192.168.0.254/svn/Proyectos.EstudioCarnicero_ProGestion/trunk@4 1b8572a8-2d6b-b84e-8c90-20ed86fa4eca
81 lines
1.6 KiB
ObjectPascal
81 lines
1.6 KiB
ObjectPascal
unit uUtils;
|
|
|
|
interface
|
|
|
|
uses
|
|
uDACDSDataTable, Classes;
|
|
|
|
|
|
function getStrList(const ASource : TStringList; const pSep: String): String;
|
|
function getArrList(const ASource : TStringList): Variant;
|
|
function CompFec(FecIni : TDateTime; FecFin : TDateTime): Integer;
|
|
|
|
implementation
|
|
|
|
uses
|
|
SysUtils, Variants, dialogs;
|
|
|
|
function getStrList(const ASource : TStringList; const pSep: String): String;
|
|
var
|
|
Cadena : String;
|
|
i: Integer;
|
|
begin
|
|
Cadena := '';
|
|
for i:=0 to (ASource.Count-1) do
|
|
begin
|
|
if i > 0 then
|
|
Cadena := Cadena + pSep;
|
|
Cadena := Cadena + ASource.Strings[i];
|
|
end;
|
|
|
|
// showmessage(Cadena);
|
|
|
|
Result := Cadena;
|
|
end;
|
|
|
|
function getArrList(const ASource : TStringList): Variant;
|
|
var
|
|
i, j: Integer;
|
|
A: array of Variant;
|
|
|
|
begin
|
|
if (ASource.Count = 0) or (length(ASource.Strings[0]) = 0) then
|
|
begin
|
|
Result := Null;
|
|
exit;
|
|
end;
|
|
|
|
j:= ASource.Count-1;
|
|
if j > 0 then
|
|
begin
|
|
for i:=0 to j do
|
|
begin
|
|
SetLength(A, i+1);
|
|
if (Length(ASource.Strings[i]) = 0)
|
|
then A[i] := ''
|
|
else A[i] := Copy(ASource.Strings[i], 0, Length(ASource.Strings[i]));
|
|
end;
|
|
Result := VarArrayOf(A);
|
|
end
|
|
else
|
|
Result := Copy(ASource.Strings[j], 0, Length(ASource.Strings[j]));
|
|
{
|
|
if j > 0 then
|
|
for i:=0 to j do
|
|
showmessage(VarToStr(A[i]))
|
|
else
|
|
showmessage(VarToStr(Result));
|
|
}
|
|
end;
|
|
|
|
function CompFec(FecIni : TDateTime; FecFin : TDateTime): Integer;
|
|
begin
|
|
if FecIni = FecFin
|
|
then Result := 0
|
|
else if FecIni > FecFin
|
|
then Result := 1
|
|
else Result := 2;
|
|
end;
|
|
|
|
end.
|