Skip to content

Commit

Permalink
[+] TStr: RemoveEmptyStrings, TrimFromChar(Str)Pos
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdp committed Sep 19, 2021
1 parent 751f1d7 commit be665a9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Base/JPL.TStr.pas
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ TStr = record
// The SplitStrToArrayEx procedure uses the initial allocation of the size of the array and incrementing its size by the ArrDeltaSize value
// to avoid increasing the size of the array repeatedly by 1.
class procedure SplitStrToArrayEx(s: string; var Arr: TStringDynArray; const EndLineStr: string = sLineBreak; ArrDeltaSize: WORD = 100); static;
class procedure RemoveEmptyStrings(var Arr: TStringDynArray); static;

class function EnsureBounds(const s: string; LeftBound: string = '['; RightBound: string = ']'): string; static;
class function AddBounds(const s: string; LeftBound: string = '['; RightBound: string = ']'): string; static;
Expand Down Expand Up @@ -105,6 +106,8 @@ TStr = record
class function TrimFromEnd(const s: string; const StringToCut: string): string; static;
class function TrimFromStart(const s: string; const StringToCut: string): string; static;
class function TrimENDL(const s: string): string; static;
class function TrimFromCharPosToEnd(const s: string; const AChar: Char): string; static;
class function TrimFromStrPosToEnd(const Src: string; const AStr: string): string; static;

class function CharCount(const s: string; const AChar: Char): integer; static;
class function FirstCharPos(const s: string; const AChar: Char): integer; static;
Expand Down Expand Up @@ -238,6 +241,11 @@ class procedure TStr.SplitStrToArrayEx(s: string; var Arr: TStringDynArray; cons
JPL.Strings.SplitStrToArrayEx(s, Arr, EndLineStr, ArrDeltaSize);
end;

class procedure TStr.RemoveEmptyStrings(var Arr: TStringDynArray);
begin
JPL.Strings.RemoveEmptyStrings(Arr);
end;

class function TStr.SplitStr(const InStr: string; out LeftStr, RightStr: string; const Separator: string): Boolean;
begin
Result := JPL.Strings.SplitStr(InStr, LeftStr, RightStr, Separator);
Expand Down Expand Up @@ -371,6 +379,16 @@ class function TStr.EnsureBounds(const s: string; LeftBound, RightBound: string)
Result := JPL.Strings.EnsureBounds(s, LeftBound, RightBound);
end;

class function TStr.TrimFromStrPosToEnd(const Src, AStr: string): string;
begin
Result := JPL.Strings.TrimFromStrPosToEnd(Src, AStr);
end;

class function TStr.TrimFromCharPosToEnd(const s: string; const AChar: Char): string;
begin
Result := JPL.Strings.TrimFromCharPosToEnd(s, AChar);
end;

class function TStr.TrimFromEnd(const s: string; const StringToCut: string): string;
begin
Result := JPL.Strings.TrimFromEnd(s, StringToCut);
Expand Down

0 comments on commit be665a9

Please sign in to comment.