mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 21:49:06 +02:00
* Patch from Maciej Izak for delphi compatible TLocaleOptions (bug ID 30660)
git-svn-id: trunk@34683 -
This commit is contained in:
parent
cf13bacbba
commit
5810ff8154
@ -112,6 +112,14 @@ Function UpperCase(Const S : AnsiString) : AnsiString;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function UpperCase(const s: string; LocaleOptions: TLocaleOptions): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
begin
|
||||||
|
case LocaleOptions of
|
||||||
|
loInvariantLocale: Result:=UpperCase(s);
|
||||||
|
loUserLocale: Result:=AnsiUpperCase(s);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ LowerCase returns a copy of S where all uppercase characters ( from A to Z )
|
{ LowerCase returns a copy of S where all uppercase characters ( from A to Z )
|
||||||
have been converted to lowercase }
|
have been converted to lowercase }
|
||||||
Function Lowercase(Const S : AnsiString) : AnsiString;
|
Function Lowercase(Const S : AnsiString) : AnsiString;
|
||||||
@ -120,6 +128,15 @@ Function Lowercase(Const S : AnsiString) : AnsiString;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function LowerCase(const s: string; LocaleOptions: TLocaleOptions): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
begin
|
||||||
|
case LocaleOptions of
|
||||||
|
loInvariantLocale: Result:=LowerCase(s);
|
||||||
|
loUserLocale: Result:=AnsiLowerCase(s);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function LowerCase(const V: variant): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function LowerCase(const V: variant): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
begin
|
begin
|
||||||
result:=LowerCase(ansistring(V));
|
result:=LowerCase(ansistring(V));
|
||||||
@ -165,6 +182,14 @@ begin
|
|||||||
result:=CAPSIZEINT(Count1-Count2);
|
result:=CAPSIZEINT(Count1-Count2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CompareStr(const S1, S2: string; LocaleOptions: TLocaleOptions): Integer; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
begin
|
||||||
|
case LocaleOptions of
|
||||||
|
loInvariantLocale: Result:=CompareStr(S1,S2);
|
||||||
|
loUserLocale: Result:=AnsiCompareStr(S1,S2);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ CompareMemRange returns the result of comparison of Length bytes at P1 and P2
|
{ CompareMemRange returns the result of comparison of Length bytes at P1 and P2
|
||||||
case result
|
case result
|
||||||
P1 < P2 < 0
|
P1 < P2 < 0
|
||||||
@ -190,7 +215,7 @@ end;
|
|||||||
S1 > S2 > 0
|
S1 > S2 > 0
|
||||||
S1 = S2 = 0 }
|
S1 = S2 = 0 }
|
||||||
|
|
||||||
function CompareText(const S1, S2: string): Integer;
|
function CompareText(const S1, S2: string): Integer; overload;
|
||||||
|
|
||||||
var
|
var
|
||||||
i, count, count1, count2: sizeint;
|
i, count, count1, count2: sizeint;
|
||||||
@ -231,18 +256,45 @@ begin
|
|||||||
result:=CAPSIZEINT(Count1-Count2);
|
result:=CAPSIZEINT(Count1-Count2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function SameText(const s1,s2:String):Boolean;
|
function CompareText(const S1, S2: string; LocaleOptions: TLocaleOptions): Integer; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
|
||||||
|
begin
|
||||||
|
case LocaleOptions of
|
||||||
|
loInvariantLocale: Result:=CompareText(S1,S2);
|
||||||
|
loUserLocale: Result:=AnsiCompareText(S1,S2);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function SameText(const s1,s2:String):Boolean; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=CompareText(S1,S2)=0;
|
Result:=CompareText(S1,S2)=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function SameStr(const s1,s2:String):Boolean;
|
function SameText(const s1,s2:String; LocaleOptions: TLocaleOptions):Boolean; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
|
||||||
|
begin
|
||||||
|
case LocaleOptions of
|
||||||
|
loInvariantLocale: Result:=SameText(S1,S2);
|
||||||
|
loUserLocale: Result:=AnsiSameText(S1,S2);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function SameStr(const s1,s2:String):Boolean; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=CompareStr(S1,S2)=0;
|
Result:=CompareStr(S1,S2)=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function SameStr(const s1,s2:String; LocaleOptions: TLocaleOptions):Boolean; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
|
||||||
|
begin
|
||||||
|
case LocaleOptions of
|
||||||
|
loInvariantLocale: Result:=SameStr(S1,S2);
|
||||||
|
loUserLocale: Result:=AnsiSameStr(S1,S2);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{$ifndef FPC_NOGENERICANSIROUTINES}
|
{$ifndef FPC_NOGENERICANSIROUTINES}
|
||||||
{==============================================================================}
|
{==============================================================================}
|
||||||
{ Ansi string functions }
|
{ Ansi string functions }
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
type
|
type
|
||||||
PString = ObjPas.PString;
|
PString = ObjPas.PString;
|
||||||
|
TLocaleOptions = (loInvariantLocale, loUserLocale);
|
||||||
|
|
||||||
{ For FloatToText }
|
{ For FloatToText }
|
||||||
TFloatFormat = (ffGeneral, ffExponent, ffFixed, ffNumber, ffCurrency);
|
TFloatFormat = (ffGeneral, ffExponent, ffFixed, ffNumber, ffCurrency);
|
||||||
@ -69,16 +70,22 @@ procedure DisposeStr(S: PShortString); overload;
|
|||||||
procedure AssignStr(var P: PString; const S: string);
|
procedure AssignStr(var P: PString; const S: string);
|
||||||
procedure AppendStr(var Dest: String; const S: string);
|
procedure AppendStr(var Dest: String; const S: string);
|
||||||
function UpperCase(const s: string): string; overload;
|
function UpperCase(const s: string): string; overload;
|
||||||
|
function UpperCase(const s: string; LocaleOptions: TLocaleOptions): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function LowerCase(const s: string): string; overload;
|
function LowerCase(const s: string): string; overload;
|
||||||
|
function LowerCase(const s: string; LocaleOptions: TLocaleOptions): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
{ the compiler can't decide else if it should use the char or the ansistring
|
{ the compiler can't decide else if it should use the char or the ansistring
|
||||||
version for a variant }
|
version for a variant }
|
||||||
function LowerCase(const V: variant): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function LowerCase(const V: variant): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function CompareStr(const S1, S2: string): Integer; overload;
|
function CompareStr(const S1, S2: string): Integer; overload;
|
||||||
|
function CompareStr(const S1, S2: string; LocaleOptions: TLocaleOptions): Integer; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function CompareMemRange(P1, P2: Pointer; Length: PtrUInt): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function CompareMemRange(P1, P2: Pointer; Length: PtrUInt): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function CompareMem(P1, P2: Pointer; Length: PtrUInt): Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function CompareMem(P1, P2: Pointer; Length: PtrUInt): Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function CompareText(const S1, S2: string): Integer;
|
function CompareText(const S1, S2: string): Integer; overload;
|
||||||
function SameText(const s1,s2:String):Boolean;
|
function CompareText(const S1, S2: string; LocaleOptions: TLocaleOptions): Integer; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function SameStr(const s1,s2:String):Boolean;
|
function SameText(const s1,s2:String):Boolean; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
function SameText(const s1,s2:String; LocaleOptions: TLocaleOptions):Boolean; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
function SameStr(const s1,s2:String):Boolean; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
function SameStr(const s1,s2:String; LocaleOptions: TLocaleOptions):Boolean; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
|
||||||
function AnsiUpperCase(const s: string): string;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiUpperCase(const s: string): string;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function AnsiLowerCase(const s: string): string;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiLowerCase(const s: string): string;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
Loading…
Reference in New Issue
Block a user