Some missing SysUtils functions
Original Reporter info from Mantis: wanderlan
-
Reporter name: Wanderlan Santos dos Anjos
Original Reporter info from Mantis: wanderlan
- Reporter name: Wanderlan Santos dos Anjos
Description:
Delphi 7 declare this SysUtils functions, missing in FPC:
function StrToDateDef(const S: string; const Default: TDateTime): TDateTime;
function StrToBoolDef(const S: string; const Default: Boolean): Boolean;
procedure ReplaceTime(var DateTime: TDateTime; const NewTime: TDateTime);
function AnsiDequotedStr(const S: string; AQuote: Char): string;
Additional information:
Suggest implementations:
function StrToDateDef(const S: string; const Default: TDateTime): TDateTime; begin
try
Result := StrToDate(S)
except
Result := Default
end;
end;
function StrToBoolDef(const S: string; const Default: Boolean): Boolean;
begin
try
Result := StrToBool(S)
except
Result := Default
end;
end;
procedure ReplaceTime(var DateTime: TDateTime; const NewTime: TDateTime);
begin
DateTime := Trunc(DateTime);
if DateTime >= 0 then
DateTime := DateTime + Abs(Frac(NewTime))
else
DateTime := DateTime - Abs(Frac(NewTime));
end;
function AnsiDequotedStr(const S: string; AQuote: Char): string;
begin
if (S <> '') and (S[1] = AQuote) and (S[length(S)] = AQuote) then
Result := copy(S, 2, length(S)-2)
else
Result := S
end;
Mantis conversion info:
- Mantis ID: 7680
- Version: 2.2.0