mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 00:50:33 +02:00
* datetotime-def functions (but not yet FormatSettings) + ansidequotedstr (turned
out to be extractquotestr wrapper). git-svn-id: trunk@5032 -
This commit is contained in:
parent
0e7763b0e5
commit
304be38ec1
@ -768,7 +768,7 @@ begin
|
||||
end;
|
||||
{$endif unix}
|
||||
|
||||
|
||||
// ieuw. These should be written to work without exceptions?
|
||||
function TryStrToDate(const S: string; out Value: TDateTime): Boolean;
|
||||
begin
|
||||
result:=true;
|
||||
@ -814,3 +814,21 @@ function TryStrToDateTime(const S: string; out Value: TDateTime): Boolean;
|
||||
// function TryStrToDateTime(const S: string; out Value: TDateTime; const FormatSettings: TFormatSettings): Boolean;
|
||||
|
||||
|
||||
function StrToDateDef(const S: string; const Defvalue : TDateTime): TDateTime;
|
||||
begin
|
||||
if not TryStrToDate(s,Result) Then
|
||||
result:=defvalue;
|
||||
end;
|
||||
|
||||
function StrToTimeDef(const S: string; const Defvalue : TDateTime): TDateTime;
|
||||
begin
|
||||
if not TryStrToTime(s,Result) Then
|
||||
result:=defvalue;
|
||||
end;
|
||||
|
||||
function StrToDateTimeDef(const S: string; const Defvalue : TDateTime): TDateTime;
|
||||
begin
|
||||
if not TryStrToDateTime(s,Result) Then
|
||||
result:=defvalue;
|
||||
end;
|
||||
|
||||
|
@ -124,11 +124,17 @@ procedure DateTimeToString(out Result: string; const FormatStr: string; const Da
|
||||
Function DateTimeToFileDate(DateTime : TDateTime) : Longint;
|
||||
Function FileDateToDateTime (Filedate : Longint) :TDateTime;
|
||||
function TryStrToDate(const S: string; out Value: TDateTime): Boolean;
|
||||
// function TryStrToDate(const S: string; out Value: TDateTime; const FormatSettings: TFormatSettings): Boolean;
|
||||
function TryStrToTime(const S: string; out Value: TDateTime): Boolean;
|
||||
// function TryStrToTime(const S: string; out Value: TDateTime; const FormatSettings: TFormatSettings): Boolean;
|
||||
function TryStrToDateTime(const S: string; out Value: TDateTime): Boolean;
|
||||
|
||||
// function TryStrToDate(const S: string; out Value: TDateTime; const FormatSettings: TFormatSettings): Boolean;
|
||||
// function TryStrToTime(const S: string; out Value: TDateTime; const FormatSettings: TFormatSettings): Boolean;
|
||||
// function TryStrToDateTime(const S: string; out Value: TDateTime; const FormatSettings: TFormatSettings): Boolean;
|
||||
|
||||
function StrToDateDef(const S: string; const Defvalue : TDateTime): TDateTime;
|
||||
function StrToTimeDef(const S: string; const Defvalue : TDateTime): TDateTime;
|
||||
function StrToDateTimeDef(const S: string; const Defvalue : TDateTime): TDateTime;
|
||||
|
||||
function CurrentYear:Word;
|
||||
{ FPC Extra }
|
||||
Procedure GetLocalTime(var SystemTime: TSystemTime);
|
||||
|
@ -1336,6 +1336,17 @@ begin
|
||||
Result:=FloatToStrF(Value,ffNumber,15,2);
|
||||
end;
|
||||
|
||||
function AnsiDequotedStr(const S: string; AQuote: Char): string;
|
||||
|
||||
var p : pchar;
|
||||
|
||||
begin
|
||||
p:=pchar(s); // work around CONST
|
||||
result:=AnsiExtractquotedStr(p,AQuote);
|
||||
if result='' Then
|
||||
result:=s;
|
||||
end;
|
||||
|
||||
function StrToCurr(const S: string): Currency;
|
||||
begin
|
||||
if not TextToFloat(PChar(S), Result, fvCurrency) then
|
||||
|
@ -94,6 +94,7 @@ function TrimLeft(const S: string): string;
|
||||
function TrimRight(const S: string): string;
|
||||
function QuotedStr(const S: string): string;
|
||||
function AnsiQuotedStr(const S: string; Quote: char): string;
|
||||
function AnsiDequotedStr(const S: string; AQuote: Char): string;
|
||||
function AnsiExtractQuotedStr(var Src: PChar; Quote: Char): string;
|
||||
function AdjustLineBreaks(const S: string): string;
|
||||
function AdjustLineBreaks(const S: string; Style: TTextLineBreakStyle): string;
|
||||
|
Loading…
Reference in New Issue
Block a user