mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 05:00:12 +02:00
* Patch from Serge Anvarov with missing strutils aliases. Mantis #35047
git-svn-id: trunk@41263 -
This commit is contained in:
parent
3a6d0d9d41
commit
86168dfdd1
@ -20,7 +20,7 @@ unit StrUtils;
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils{, Types};
|
||||
SysUtils, Types;
|
||||
|
||||
{ ---------------------------------------------------------------------
|
||||
Case insensitive search/replace
|
||||
@ -36,6 +36,11 @@ Function AnsiIndexText(const AText: string; const AValues: array of string): Int
|
||||
Function StartsText(const ASubText, AText: string): Boolean; inline;
|
||||
Function EndsText(const ASubText, AText: string): Boolean; inline;
|
||||
|
||||
function ResemblesText(const AText, AOther: string): Boolean; inline;
|
||||
function ContainsText(const AText, ASubText: string): Boolean; inline;
|
||||
function MatchText(const AText: string; const AValues: array of string): Boolean; inline;
|
||||
function IndexText(const AText: string; const AValues: array of string): Integer; inline;
|
||||
|
||||
{ ---------------------------------------------------------------------
|
||||
Case sensitive search/replace
|
||||
---------------------------------------------------------------------}
|
||||
@ -54,6 +59,11 @@ Function IndexStr(const AText: UnicodeString; const AValues: array of UnicodeStr
|
||||
Function IndexText(const AText: UnicodeString; const AValues: array of UnicodeString): Integer;
|
||||
Operator in (const AText: string; const AValues: array of string):Boolean;inline;
|
||||
Operator in (const AText: UnicodeString; const AValues: array of UnicodeString):Boolean;inline;
|
||||
|
||||
function ContainsStr(const AText, ASubText: string): Boolean; inline;
|
||||
function MatchStr(const AText: string; const AValues: array of string): Boolean; inline;
|
||||
function IndexStr(const AText: string; const AValues: array of string): Integer; inline;
|
||||
|
||||
{ ---------------------------------------------------------------------
|
||||
Miscellaneous
|
||||
---------------------------------------------------------------------}
|
||||
@ -67,6 +77,8 @@ Function IfThen(AValue: Boolean; const ATrue: string; const AFalse: string = '')
|
||||
function NaturalCompareText (const S1 , S2 : string ): Integer ;
|
||||
function NaturalCompareText(const Str1, Str2: string; const ADecSeparator, AThousandSeparator: Char): Integer;
|
||||
|
||||
function SplitString(const S, Delimiters: string): TStringDynArray;
|
||||
|
||||
{ ---------------------------------------------------------------------
|
||||
VB emulations.
|
||||
---------------------------------------------------------------------}
|
||||
@ -146,6 +158,7 @@ type
|
||||
|
||||
Const
|
||||
AnsiResemblesProc: TCompareTextProc = @SoundexProc;
|
||||
ResemblesProc: TCompareTextProc = @SoundexProc;
|
||||
|
||||
{ ---------------------------------------------------------------------
|
||||
Other functions, based on RxStrUtils.
|
||||
@ -927,19 +940,54 @@ begin
|
||||
Result := AnsiEndsText(ASubText, AText);
|
||||
end;
|
||||
|
||||
function ResemblesText(const AText, AOther: string): Boolean;
|
||||
begin
|
||||
if Assigned(ResemblesProc) then
|
||||
Result := ResemblesProc(AText, AOther)
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function ContainsText(const AText, ASubText: string): Boolean;
|
||||
begin
|
||||
Result := AnsiContainsText(AText, ASubText);
|
||||
end;
|
||||
|
||||
function MatchText(const AText: string; const AValues: array of string): Boolean;
|
||||
begin
|
||||
Result := AnsiMatchText(AText, AValues);
|
||||
end;
|
||||
|
||||
function IndexText(const AText: string; const AValues: array of string): Integer;
|
||||
begin
|
||||
Result := AnsiIndexText(AText, AValues);
|
||||
end;
|
||||
|
||||
function ContainsStr(const AText, ASubText: string): Boolean;
|
||||
begin
|
||||
Result := AnsiContainsStr(AText, ASubText);
|
||||
end;
|
||||
|
||||
function MatchStr(const AText: string; const AValues: array of string): Boolean;
|
||||
begin
|
||||
Result := AnsiMatchStr(AText, AValues);
|
||||
end;
|
||||
|
||||
function IndexStr(const AText: string; const AValues: array of string): Integer;
|
||||
begin
|
||||
Result := AnsiIndexStr(AText, AValues);
|
||||
end;
|
||||
|
||||
function AnsiReplaceText(const AText, AFromText, AToText: string): string;
|
||||
begin
|
||||
Result := StringReplace(AText,AFromText,AToText,[rfReplaceAll,rfIgnoreCase]);
|
||||
end;
|
||||
|
||||
|
||||
function AnsiMatchText(const AText: string; const AValues: array of string): Boolean;
|
||||
begin
|
||||
Result:=(AnsiIndexText(AText,AValues)<>-1)
|
||||
end;
|
||||
|
||||
|
||||
function AnsiIndexText(const AText: string; const AValues: array of string): Integer;
|
||||
begin
|
||||
for Result := Low(AValues) to High(AValues) do
|
||||
@ -1292,6 +1340,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function SplitString(const S, Delimiters: string): TStringDynArray;
|
||||
begin
|
||||
Result := S.Split(Delimiters);
|
||||
end;
|
||||
|
||||
function NaturalCompareText (const S1 , S2 : string ): Integer ;
|
||||
begin
|
||||
Result := NaturalCompareText(S1, S2,
|
||||
|
Loading…
Reference in New Issue
Block a user