Răsfoiți Sursa

* String helpers for all string types

Michael VAN CANNEYT 2 ani în urmă
părinte
comite
0c17b8e9c6
3 a modificat fișierele cu 2086 adăugiri și 1547 ștergeri
  1. 55 1442
      rtl/objpas/sysutils/syshelp.inc
  2. 537 105
      rtl/objpas/sysutils/syshelph.inc
  3. 1494 0
      rtl/objpas/sysutils/syshelps.inc

+ 55 - 1442
rtl/objpas/sysutils/syshelp.inc

@@ -132,1449 +132,62 @@ begin
     Result:=Copy(Result,2,Length(Result)-2);
 end;
 
-{ ---------------------------------------------------------------------
-  TStringHelper
-  ---------------------------------------------------------------------}
-
-Function HaveChar(AChar : AnsiChar; const AList: array of AnsiChar) : Boolean;
-
-Var
-  I : SizeInt;
-
-begin
-  I:=0;
-  Result:=False;
-  While (Not Result) and (I<Length(AList)) do
-    begin
-    Result:=(AList[i]=AChar);
-    Inc(I);
-    end;
-end;
-
-function TStringHelper.GetChar(AIndex: SizeInt): AnsiChar;
-begin
-  Result:=Self[AIndex+1];
-end;
-
-
-function TStringHelper.GetLength: SizeInt;
-
-begin
-  Result:=System.Length(Self);
-end;
-
-
-class function TStringHelper.Compare(const A: string; const B: string): Integer;
-begin
-  Result:=Compare(A,0,B,0,System.Length(B),[]);
-end;
-
-
-class function TStringHelper.Compare(const A: string; const B: string;
-  IgnoreCase: Boolean): Integer; //deprecated 'Use same with TCompareOptions';
-begin
-  if IgnoreCase then
-    Result:=Compare(A,B,[coIgnoreCase])
-  else
-    Result:=Compare(A,B,[]);
-end;
-
-
-class function TStringHelper.Compare(const A: string; const B: string;
-  Options: TCompareOptions): Integer;
-begin
-  Result:=Compare(A,0,B,0,System.Length(B),Options);
-end;
-
-
-class function TStringHelper.Compare(const A: string; IndexA: SizeInt;
-  const B: string; IndexB: SizeInt; ALen: SizeInt): Integer;
-begin
-  Result:=Compare(A,IndexA,B,IndexB,ALen,[]);
-end;
-
-
-class function TStringHelper.Compare(const A: string; IndexA: SizeInt;
-  const B: string; IndexB: SizeInt; ALen: SizeInt; IgnoreCase: Boolean
-  ): Integer; //deprecated 'Use same with TCompareOptions';
-begin
-  if IgnoreCase then
-    Result:=Compare(A,IndexA,B,IndexB,ALen,[coIgnoreCase])
-  else
-    Result:=Compare(A,IndexA,B,IndexB,ALen,[])
-end;
-
-
-class function TStringHelper.Compare(const A: string; IndexA: SizeInt;
-  const B: string; IndexB: SizeInt; ALen: SizeInt; Options: TCompareOptions
-  ): Integer;
-
-Var
-  L : SizeInt;
-
-begin
-  L:=ALen;
-  If (L>system.Length(A)-IndexA) then
-    L:=system.Length(A)-IndexA;
-  If (L>system.Length(B)-IndexB) then
-    L:=system.Length(B)-IndexB;
-  if (coIgnoreCase in Options) then
-    begin
-    Result:=strlicomp(PAnsiChar(@A[IndexA+1]),PAnsiChar(@B[IndexB+1]),L)
-    end
-  else
-    Result:=strlcomp(PAnsiChar(@A[IndexA+1]),PAnsiChar(@B[IndexB+1]),L);
-end;
-
-
-class function TStringHelper.CompareOrdinal(const A: string; const B: string
-  ): Integer;
-
-Var
-  L : SizeInt;
-
-begin
-  L:=System.Length(B);
-  if L>System.Length(A) then
-    L:=System.Length(A);
-  Result:=CompareOrdinal(A,0,B,0,L);
-end;
-
-
-class function TStringHelper.CompareOrdinal(const A: string; IndexA: SizeInt;
-  const B: string; IndexB: SizeInt; ALen: SizeInt): Integer;
-
-begin
-  Result:=StrLComp(PAnsiChar(@A[IndexA+1]), PAnsiChar(@B[IndexB+1]), ALen);
-end;
-
-
-class function TStringHelper.CompareText(const A: string; const B: string
-  ): Integer;
-begin
-  Result:=Sysutils.CompareText(A,B);
-end;
-
-
-class function TStringHelper.Copy(const Str: string): string;
-begin
-  Result:=Str;
-  UniqueString(Result);
-end;
-
-
-class function TStringHelper.Create(AChar: AnsiChar; ACount: SizeInt): string;
-begin
-   Result:=StringOfChar(AChar,ACount);
-end;
-
-
-class function TStringHelper.Create(const AValue: array of AnsiChar): string;
-
-begin
-  Result:=Create(AValue,0,System.Length(AValue));
-end;
-
-
-class function TStringHelper.Create(const AValue: array of AnsiChar;
-  StartIndex: SizeInt; ALen: SizeInt): string;
-begin
-  SetLength(Result,ALen);
-  if ALen>0 then
-    Move(AValue[StartIndex],Result[1],ALen);
-end;
-
-
-class function TStringHelper.EndsText(const ASubText, AText: string): Boolean;
-begin
-  Result:=(ASubText<>'') and (sysutils.CompareText(System.Copy(AText,System.Length(AText)-System.Length(ASubText)+1,System.Length(ASubText)),ASubText)=0);
-end;
-
-
-class function TStringHelper.Equals(const a: string; const b: string): Boolean;
-begin
-  Result:=A=B;
-end;
-
-
-class function TStringHelper.Format(const AFormat: string;
-  const args: array of const): string;
-begin
-  Result:=Sysutils.Format(AFormat,Args);
-end;
-
-
-class function TStringHelper.IsNullOrEmpty(const AValue: string): Boolean;
-begin
-  Result:=system.Length(AValue)=0;
-end;
-
-
-class function TStringHelper.IsNullOrWhiteSpace(const AValue: string): Boolean;
-const
-  LWhiteSpace = [#0..' '];
-var
-  I: SizeInt;
-begin
-  for I:=1 to System.Length(AValue) do
-    if not (AValue[I] in LWhiteSpace) then
-      exit(False);
-  Result:=True;
-end;
-
-
-class function TStringHelper.Join(const Separator: string;
-  const Values: array of const): string;
-
-Var
-  SValues : Array of string;
-  I,L : SizeInt;
-  S : String;
-  P : ^TVarRec;
-
-begin
-  L:=System.Length(Values);
-  SetLength(SValues,L);
-  Dec(L);
-  for I:=0 to L do
-    begin
-    S:='';
-    P:=@Values[I];
-    Case P^.VType of
-      vtInteger  : S:=IntToStr(P^.VInteger);
-      vtBoolean  : S:=BoolToStr(P^.VBoolean, True);
-      vtChar     : S:=P^.VChar;
-      vtPChar    : S:= string(P^.VPChar);
-      {$ifndef FPUNONE}
-      vtExtended : S:=FloatToStr(P^.VExtended^);
-      {$endif}
-      vtObject   : S:=TObject(P^.VObject).Classname;
-      vtClass    : S:=P^.VClass.Classname;
-      vtCurrency : S:=CurrToStr(P^.VCurrency^);
-      vtVariant  : S:=(P^.VVariant^);
-      vtInt64    : S:=IntToStr(PInt64(P^.VInt64)^);
-      vtQword    : S:=IntToStr(PQWord(P^.VQword)^);
-      vtWideChar     : S:=WideString(P^.VWideChar);
-      vtPWideChar     : S:=WideString(P^.VPWideChar);
-      vtUnicodeString : S:=UnicodeString(P^.VUnicodeString);
-      vtAnsiString    : S:=Ansistring(P^.VAnsiString);
-    else
-      S:=Format('Unknown type: %d',[P^.VType]);
-    end;
-    SValues[I]:=S;
-    end;
-  Result:=Join(Separator,SValues);
-end;
-
-
-class function TStringHelper.Join(const Separator: string;
-  const Values: array of string): string;
-begin
-  Result:=Join(Separator,Values,0,System.Length(Values));
-end;
-
-
-class function TStringHelper.Join(const Separator: string;
-  const Values: array of string; StartIndex: SizeInt; ACount: SizeInt): string;
-Var
-  VLen,I,CountLim,NR,NSep,N : SizeInt;
-  Rp: PAnsiChar;
-begin
-  VLen:=System.Length(Values);
-  If (ACount=0)  then
-    Exit('');
-  CountLim:=VLen-StartIndex;
-  if ACount>CountLim then
-    ACount:=CountLim;
-  If (ACount<0) or (StartIndex>VLen) or (StartIndex<0) then
-    raise ERangeError.Create(SRangeError);
-  if ACount=1 then
-    exit(Values[StartIndex]);
-  NSep:=System.Length(Separator);
-  NR:=(ACount-1)*NSep;
-  for I:=StartIndex to StartIndex+ACount-1 do
-    NR:=NR+System.Length(Values[I]);
-  SetLength(Result,NR);
-  Rp:=@Result[1];
-  for I:=StartIndex to StartIndex+ACount-1 do
-     begin
-        if I>StartIndex then
-          begin
-            Move(separator[1],Rp^,NSep*sizeof(AnsiChar));
-            Rp:=Rp+NSep;
-          end;
-        N:=System.Length(Values[I]);
-        Move(Values[I][1],Rp^,N*sizeof(AnsiChar));
-        Rp:=Rp+N;
-     end;
-end;
-
-
-class function TStringHelper.LowerCase(const S: string): string;
-begin
-  Result:=sysutils.Lowercase(S);
-end;
-
-
-class function TStringHelper.Parse(const AValue: Boolean): string;
-begin
-  Result:=BoolToStr(AValue);
-end;
-
-
-class function TStringHelper.Parse(const AValue: Extended): string;
-begin
-  Result:=FloatToStr(AValue);
-end;
-
-
-class function TStringHelper.Parse(const AValue: Int64): string;
-begin
-  Result:=IntToStr(AValue);
-end;
-
-
-class function TStringHelper.Parse(const AValue: Integer): string;
-begin
-  Result:=IntToStr(AValue);
-end;
-
-
-class function TStringHelper.ToBoolean(const S: string): Boolean;
-begin
-  Result:=StrToBool(S);
-end;
-
-
-class function TStringHelper.ToDouble(const S: string): Double;
-begin
-  Result:=StrToFloat(S);
-end;
-
-
-class function TStringHelper.ToExtended(const S: string): Extended;
-begin
-  Result:=StrToFloat(S);
-end;
-
-
-class function TStringHelper.ToInt64(const S: string): Int64;
-begin
-  Result:=StrToInt64(S);
-end;
-
-
-class function TStringHelper.ToInteger(const S: string): Integer;
-begin
-  Result:=StrToInt(S);
-end;
-
-
-class function TStringHelper.ToSingle(const S: string): Single;
-begin
-  Result:=StrToFloat(S);
-end;
-
-
-class function TStringHelper.UpperCase(const S: string): string;
-begin
-  Result:=sysutils.Uppercase(S);
-end;
-
-
-function TStringHelper.CompareTo(const B: string): Integer;
-begin
-  // Order is important
-  Result:=sysUtils.StrComp(PAnsiChar(Self),PAnsiChar(B));
-end;
-
-procedure TStringHelper.CopyTo(SourceIndex: SizeInt; var destination: array of AnsiChar; DestinationIndex: SizeInt; ACount: SizeInt);
-
-Var
-  P1,P2 : PAnsiChar;
-begin
-//  Writeln('((',DestinationIndex,'+',ACount,')<',System.Length(Destination),')  : ', ((DestinationIndex+ACount)<System.Length(Destination)));
-  if ((DestinationIndex+ACount)<=System.Length(Destination)) then
-    begin
-//    Writeln('AHA');
-    P1:=@Self[SourceIndex+1];
-    P2:=@Destination[DestinationIndex];
-    Move(P1^,P2^,ACount*SizeOf(AnsiChar));
-    end;
-end;
-
-function TStringHelper.Contains(const AValue: string; IgnoreCase: Boolean): Boolean;
-begin
-  if IgnoreCase then
-    Result:=Pos(LowerCase(AValue),LowerCase(Self))>0
-  else
-    Result:=Pos(AValue,Self)>0;
-end;
-
-
-function TStringHelper.CountChar(const C: AnsiChar): SizeInt;
-
-Var
-  S : AnsiChar;
-begin
-  Result:=0;
-  For S in Self do
-    if (S=C) then
-      Inc(Result);
-end;
-
-
-function TStringHelper.DeQuotedString: string;
-begin
-  Result:=DeQuotedString('''');
-end;
-
-
-function TStringHelper.DeQuotedString(const AQuoteChar: AnsiChar): string;
-
-var
-  L,I : SizeInt;
-  Res : Array of AnsiChar;
-  PS,PD : PAnsiChar;
-  IsQuote : Boolean;
-
-begin
-  L:=System.Length(Self);
-  if (L<2) or Not ((Self[1]=AQuoteChar) and (Self[L]=AQuoteChar)) then
-    Exit(Self);
-  SetLength(Res,L);
-  IsQuote:=False;
-  PS:=@Self[2];
-  PD:=@Res[0];
-  For I:=2 to L-1 do
-    begin
-    if (PS^=AQuoteChar) then
-      begin
-      IsQuote:=Not IsQuote;
-      if Not IsQuote then
-        begin
-        PD^:=PS^;
-        Inc(PD);
-        end;
-      end
-    else
-      begin
-      if IsQuote then
-        IsQuote:=false;
-      PD^:=PS^;
-      Inc(PD);
-      end;
-    Inc(PS);
-    end;
-  SetString(Result,@Res[0],PD-@Res[0]);
-end;
-
-
-function TStringHelper.EndsWith(const AValue: string): Boolean;
-begin
-  Result:=EndsWith(AValue,False);
-end;
-
-
-function TStringHelper.EndsWith(const AValue: string; IgnoreCase: Boolean): Boolean;
-
-Var
-  L,NS : SizeInt;
-
-begin
-  L:=system.Length(AVAlue);
-  NS:=System.Length(Self);
-  Result:=L<=NS;
-  if Result then
-    if IgnoreCase then
-      Result:=SameText(System.Copy(Self,NS-L+1,L),AValue)
-    else
-      Result:=CompareChar(PAnsiChar(Pointer(Self))[NS-L],PAnsiChar(Pointer(AValue))^,L)=0;
-end;
-
-
-function TStringHelper.Equals(const AValue: string; IgnoreCase: Boolean = False): Boolean;
-
-begin
-  if IgnoreCase then
-    Result:=SameText(Self,aValue)
-  else
-    Result:=(Self=AValue);
-end;
-
-
-function TStringHelper.Format(const args: array of const): string;
-
-begin
-  Result:=Format(Self,Args);
-end;
-
-
-function TStringHelper.GetHashCode: Integer;
-
-// Taken from contnrs, fphash
-var
-  P,pmax : PAnsiChar;
-begin
-{$push}
-{$Q-}
-  Result:=0;
-  P:=PAnsiChar(Self);
-  pmax:=p+length;
-  while (p<pmax) do
-    begin
-    Result:=LongWord(LongInt(Result shl 5) - LongInt(Result)) xor LongWord(P^);
-    Inc(p);
-    end;
-{$pop}
-end;
-
-
-function TStringHelper.IndexOf(AValue: AnsiChar): SizeInt;
-begin
-  Result:=IndexOf(AValue,0,Length);
-end;
-
-
-function TStringHelper.IndexOf(const AValue: string): SizeInt;
-begin
-  Result:=IndexOf(AValue,0,Length);
-end;
-
-
-function TStringHelper.IndexOf(AValue: AnsiChar; StartIndex: SizeInt): SizeInt;
-begin
-  Result:=IndexOf(AValue,StartIndex,Length);
-end;
-
-
-function TStringHelper.IndexOf(const AValue: string; StartIndex: SizeInt
-  ): SizeInt;
-begin
-  Result:=IndexOf(AValue,StartIndex,Length);
-end;
-
-
-function TStringHelper.IndexOf(AValue: AnsiChar; StartIndex: SizeInt;
-  ACount: SizeInt): SizeInt;
-
-Var
-  CountLim : SizeInt;
-
-begin
-  if StartIndex<0 then
-    StartIndex:=0;
-  CountLim:=System.Length(Self)-StartIndex;
-  if ACount>CountLim then
-    ACount:=CountLim;
-  if ACount<=0 then
-    Exit(-1);
-  // pointer casts are to access self as 0 based index!
-  Result:=IndexChar(PAnsiChar(Pointer(self))[StartIndex],ACount,AValue);
-  if Result>=0 then
-    Result:=Result+StartIndex;
-end;
-
-
-function TStringHelper.IndexOf(const AValue: string; StartIndex: SizeInt;
-  ACount: SizeInt): SizeInt;
-
-Var
-  CountLim,NV,Ofs : SizeInt;
-  SP,SE : PAnsiChar;
-
-begin
-  if StartIndex<0 then
-    StartIndex:=0;
-  CountLim:=System.Length(Self)-StartIndex;
-  if ACount>CountLim then
-    ACount:=CountLim;
-  NV:=System.Length(AValue);
-  if (NV>0) and (ACount>=NV) then
-    begin
-      SP:=PAnsiChar(Pointer(Self))+StartIndex;
-      SE:=SP+ACount-NV+1;
-      repeat
-        Ofs:=IndexChar(SP^,SE-SP,PAnsiChar(Pointer(AValue))[0]);
-        if Ofs<0 then
-          Break;
-        SP:=SP+Ofs+1;
-        if CompareChar(SP^,PAnsiChar(Pointer(AValue))[1],NV-1)=0 then
-          Exit(SP-PAnsiChar(Pointer(Self))-1);
-      until false;
-    end;
-  Result:=-1;
-end;
-
-function TStringHelper.IndexOfUnQuoted(const AValue: string; StartQuote,
-  EndQuote: AnsiChar; StartIndex: SizeInt = 0): SizeInt;
-
-Var
-  LV : SizeInt;
-
-  Function MatchAt(I : SizeInt) : Boolean ; Inline;
-
-  Var
-    J : SizeInt;
-
-  begin
-    J:=1;
-    Repeat
-      Result:=(Self[I+J-1]=AValue[j]);
-      Inc(J);
-    Until (Not Result) or (J>LV);
-  end;
-
-Var
-  I,L,Q: SizeInt;
-
-begin
-  Result:=-1;
-  LV:=system.Length(AValue);
-  L:=Length-LV+1;
-  if L<0 then
-    L:=0;
-  I:=StartIndex+1;
-  Q:=0;
-  if StartQuote=EndQuote then
-    begin
-    While (Result=-1) and (I<=L) do
-      begin
-      if (Self[I]=StartQuote) then
-        Q:=1-Q;
-      if (Q=0) and MatchAt(i) then
-        Result:=I-1;
-      Inc(I);
-      end;
-    end
-  else
-    begin
-    While (Result=-1) and (I<=L) do
-      begin
-      if Self[I]=StartQuote then
-        Inc(Q)
-      else if (Self[I]=EndQuote) and (Q>0) then
-        Dec(Q);
-      if (Q=0) and MatchAt(i) then
-        Result:=I-1;
-      Inc(I);
-      end;
-    end;
-end;
-
-
-function TStringHelper.IndexOfAny(const AnyOf: array of AnsiChar): SizeInt;
-begin
-  Result:=IndexOfAny(AnyOf,0,Length);
-end;
-
-
-function TStringHelper.IndexOfAny(const AnyOf: array of AnsiChar;
-  StartIndex: SizeInt): SizeInt;
-begin
-  Result:=IndexOfAny(AnyOf,StartIndex,Length);
-end;
-
-
-function TStringHelper.IndexOfAny(const AnyOf: array of AnsiChar;
-  StartIndex: SizeInt; ACount: SizeInt): SizeInt;
-
-Var
-  i,L : SizeInt;
-
-begin
-  I:=StartIndex+1;
-  L:=I+ACount-1;
-  If L>Length then
-    L:=Length;
-  Result:=-1;
-  While (Result=-1) and (I<=L) do
-    begin
-    if HaveChar(Self[i],AnyOf) then
-      Result:=I-1;
-    Inc(I);
-    end;
-end;
-
-function TStringHelper.IndexOfAny(const AnyOf: array of String): SizeInt;
-begin
-  Result:=IndexOfAny(AnyOf,0,Length);
-end;
-
-function TStringHelper.IndexOfAny(const AnyOf: array of String;
-  StartIndex: SizeInt): SizeInt;
-begin
-  Result:=IndexOfAny(AnyOf,StartIndex,Length-StartIndex);
-end;
-
-function TStringHelper.IndexOfAny(const AnyOf: array of String;
-  StartIndex: SizeInt; ACount: SizeInt): SizeInt;
-
-Var
-  M : SizeInt;
-
-begin
-  Result:=IndexOfAny(AnyOf,StartIndex,ACount,M);
-end;
-
-function TStringHelper.IndexOfAny(const AnyOf: array of String;
-  StartIndex: SizeInt; ACount: SizeInt; out AMatch: SizeInt): SizeInt;
-
-Var
-  L,I : SizeInt;
-
-begin
-  Result:=-1;
-  For I:=0 to System.Length(AnyOf)-1 do
-    begin
-    L:=IndexOf(AnyOf[i],StartIndex,ACount);
-    If (L>=0) and ((Result=-1) or (L<Result)) then
-      begin
-      Result:=L;
-      AMatch:=I;
-      end;
-    end;
-end;
-
-
-function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of AnsiChar;
-  StartQuote, EndQuote: AnsiChar): SizeInt;
-begin
-  Result:=IndexOfAnyUnquoted(AnyOf,StartQuote,EndQuote,0,Length);
-end;
-
-
-function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of AnsiChar;
-  StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt): SizeInt;
-begin
-  Result:=IndexOfAnyUnquoted(AnyOf,StartQuote,EndQuote,StartIndex,Length);
-end;
-
-
-function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of AnsiChar;
-  StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt;
-
-Var
-  I,L : SizeInt;
-  Q : SizeInt;
-
-begin
-  Result:=-1;
-  L:=StartIndex+ACount-1;
-  if L>Length then
-    L:=Length;
-  I:=StartIndex+1;
-  Q:=0;
-  if StartQuote=EndQuote then
-    begin
-    While (Result=-1) and (I<=L) do
-      begin
-      if (Self[I]=StartQuote) then
-        Q:=1-Q;
-      if (Q=0) and HaveChar(Self[i],AnyOf) then
-        Result:=I-1;
-      Inc(I);
-      end;
-    end
-  else
-  begin
-    While (Result=-1) and (I<=L) do
-      begin
-      if Self[I]=StartQuote then
-        Inc(Q)
-      else if (Self[I]=EndQuote) and (Q>0) then
-        Dec(Q);
-      if (Q=0) and HaveChar(Self[i],AnyOf) then
-        Result:=I-1;
-      Inc(I);
-      end;
-    end;
-
-end;
-
-function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of string;
-  StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt; out Matched: SizeInt
-  ): SizeInt;
-
-Var
-  L,I : SizeInt;
-
-begin
-  Result:=-1;
-  For I:=0 to System.Length(AnyOf)-1 do
-    begin
-    L:=IndexOfUnquoted(AnyOf[i],StartQuote,EndQuote,StartIndex);
-    If (L>=0) and ((Result=-1) or (L<Result)) then
-      begin
-      Result:=L;
-      Matched:=I;
-      end;
-    end;
-end;
-
-
-function TStringHelper.Insert(StartIndex: SizeInt; const AValue: string
-  ): string;
-begin
-  system.Insert(AValue,Self,StartIndex+1);
-  Result:=Self;
-end;
-
-
-function TStringHelper.IsDelimiter(const Delimiters: string; Index: SizeInt
-  ): Boolean;
-begin
-  Result:=sysutils.IsDelimiter(Delimiters,Self,Index+1);
-end;
-
-
-function TStringHelper.IsEmpty: Boolean;
-begin
-  Result:=(Length=0)
-end;
-
-
-function TStringHelper.LastDelimiter(const Delims: string): SizeInt;
-begin
-  Result:=sysutils.LastDelimiter(Delims,Self)-1;
-end;
-
-
-function TStringHelper.LastIndexOf(AValue: AnsiChar): SizeInt;
-begin
-  Result:=LastIndexOf(AValue,Length-1,Length);
-end;
-
-
-function TStringHelper.LastIndexOf(const AValue: string): SizeInt;
-begin
-  Result:=LastIndexOf(AValue,Length-1,Length);
-end;
-
-
-function TStringHelper.LastIndexOf(AValue: AnsiChar; AStartIndex: SizeInt): SizeInt;
-begin
-  Result:=LastIndexOf(AValue,AStartIndex,Length);
-end;
-
-
-function TStringHelper.LastIndexOf(const AValue: string; AStartIndex: SizeInt
-  ): SizeInt;
-begin
-  Result:=LastIndexOf(AValue,AStartIndex,Length);
-end;
-
-
-function TStringHelper.LastIndexOf(AValue: AnsiChar; AStartIndex: SizeInt;
-  ACount: SizeInt): SizeInt;
-
-Var
-  Min : SizeInt;
-
-begin
-  Result:=AStartIndex+1;
-  Min:=Result-ACount+1;
-  If Min<1 then
-    Min:=1;
-  While (Result>=Min) and (Self[Result]<>AValue) do
-    Dec(Result);
-  if Result<Min then
-    Result:=-1
-  else
-    Result:=Result-1;
-end;
-
-
-function TStringHelper.LastIndexOf(const AValue: string; AStartIndex: SizeInt; ACount: SizeInt): SizeInt;
-  
-var
-  I,L,LS,M : SizeInt;
-  S : String;
-  P : PAnsiChar;
-    
-begin
-  Result:=-1;
-  LS:=system.Length(Self);
-  L:=system.Length(AValue);
-  if (L=0) or (L>LS) then
-    Exit;
-  P:=PAnsiChar(AValue);  
-  S:=Self;
-  I:=AStartIndex+1; // 1 based
-  if (I>LS) then
-    I:=LS;
-  I:=I-L+1;
-  M:=AStartIndex-ACount+2; // 1 based
-  if M<1 then
-    M:=1;
-  while (Result=-1) and (I>=M) do
-    begin
-    if (0=StrLComp(PAnsiChar(@S[I]),P,L)) then
-      Result:=I-1;
-    Dec(I);
-    end;
-end;
-
-
-function TStringHelper.LastIndexOfAny(const AnyOf: array of AnsiChar): SizeInt;
-begin
-  Result:=LastIndexOfAny(AnyOf,Length-1,Length);
-end;
-
-
-function TStringHelper.LastIndexOfAny(const AnyOf: array of AnsiChar;
-  AStartIndex: SizeInt): SizeInt;
-begin
-  Result:=LastIndexOfAny(AnyOf,AStartIndex,Length);
-end;
-
-
-function TStringHelper.LastIndexOfAny(const AnyOf: array of AnsiChar;
-  AStartIndex: SizeInt; ACount: SizeInt): SizeInt;
-
-Var
-  Min : SizeInt;
-
-begin
-  Result:=AStartIndex+1;
-  Min:=Result-ACount+1;
-  If Min<1 then
-    Min:=1;
-  While (Result>=Min) and Not HaveChar(Self[Result],AnyOf) do
-    Dec(Result);
-  if Result<Min then
-    Result:=-1
-  else
-    Result:=Result-1;
-end;
-
-
-function TStringHelper.PadLeft(ATotalWidth: SizeInt): string;
-begin
-  Result:=PadLeft(ATotalWidth,' ');
-end;
-
-
-function TStringHelper.PadLeft(ATotalWidth: SizeInt; PaddingChar: AnsiChar): string;
-Var
-  L : SizeInt;
+{$define TStringHelper:=TAnsiStringHelper}
+{$define TStringChar:=AnsiChar}
+{$define TStringType:=AnsiString}
+{$define PTStringChar:=PAnsiChar}
+{$define TSHStringArray:=TAnsiStringArray}
+{$define IS_ANSISTRINGHELPER}
+{$i syshelps.inc}
+{$undef TStringHelper}
+{$undef TStringChar}
+{$undef TStringType}
+{$undef PTStringChar}
+{$undef TSHStringArray}
+{$undef IS_ANSISTRINGHELPER}
+
+{$define TStringHelper:=TWideStringHelper}
+{$define TStringChar:=WideChar}
+{$define TStringType:=WideString}
+{$define PTStringChar:=PWideChar}
+{$define TSHStringArray:=TWideStringArray}
+{$define IS_WIDESTRINGHELPER}
+{$i syshelps.inc}
+{$undef TStringHelper}
+{$undef TStringChar}
+{$undef TStringType}
+{$undef PTStringChar}
+{$undef TSHStringArray}
+{$undef IS_WIDESTRINGHELPER}
+
+{$define TStringHelper:=TUnicodeStringHelper}
+{$define TStringChar:=UnicodeChar}
+{$define TStringType:=UnicodeString}
+{$define PTStringChar:=PUnicodeChar}
+{$define TSHStringArray:=TUnicodeStringArray}
+{$define IS_UNICODESTRINGHELPER}
+{$i syshelps.inc}
+{$undef TStringHelper}
+{$undef TStringChar}
+{$undef TStringType}
+{$undef PTStringChar}
+{$undef TSHStringArray}
+{$undef IS_UNICODESTRINGHELPER}
+
+{$define TStringHelper:=TShortStringHelper}
+{$define TStringChar:=AnsiChar}
+{$define TStringType:=ShortString}
+{$define IS_SHORTSTRINGHELPER}
+{$define PTStringChar:=PAnsiChar}
+{$define TSHStringArray:=TShortStringArray}
+{$i syshelps.inc}
+{$undef TStringHelper}
+{$undef TStringChar}
+{$undef TStringType}
+{$undef PTStringChar}
+{$undef TSHStringArray}
+{$undef IS_SHORTSTRINGHELPER}
 
-begin
-  Result:=Self;
-  L:=ATotalWidth-Length;
-  If L>0 then
-    Result:=StringOfChar(PaddingChar,L)+Result;
-end;
-
-
-function TStringHelper.PadRight(ATotalWidth: SizeInt): string;
-begin
-  Result:=PadRight(ATotalWidth,' ');
-end;
-
-
-function TStringHelper.PadRight(ATotalWidth: SizeInt; PaddingChar: AnsiChar
-  ): string;
-
-Var
-  L : SizeInt;
-
-begin
-  Result:=Self;
-  L:=ATotalWidth-Length;
-  If L>0 then
-    Result:=Result+StringOfChar(PaddingChar,L);
-end;
-
-
-function TStringHelper.QuotedString: string;
-begin
-  Result:=QuotedStr(Self);
-end;
-
-
-function TStringHelper.QuotedString(const AQuoteChar: AnsiChar): string;
-begin
-  Result:=AnsiQuotedStr(Self,AQuoteChar);
-end;
-
-
-function TStringHelper.Remove(StartIndex: SizeInt): string;
-begin
-  Result:=Remove(StartIndex,Self.Length-StartIndex);
-end;
-
-
-function TStringHelper.Remove(StartIndex: SizeInt; ACount: SizeInt): string;
-begin
-  Result:=Self;
-  System.Delete(Result,StartIndex+1,ACount);
-end;
-
-
-function TStringHelper.Replace(OldChar: AnsiChar; NewChar: AnsiChar): string;
-begin
-  Result:=Replace(OldChar,NewChar,[rfReplaceAll]);
-end;
-
-
-function TStringHelper.Replace(OldChar: AnsiChar; NewChar: AnsiChar;
-  ReplaceFlags: TReplaceFlags): string;
-var
-  Sp,Se,Rp : PAnsiChar;
-  Ofs : SizeInt;
-begin
-  if rfIgnoreCase in ReplaceFlags then
-    exit(StringReplace(Self,OldChar,NewChar,ReplaceFlags));
-
-  Sp:=PAnsiChar(Pointer(Self));
-  Se:=Sp+System.Length(Self);
-  Ofs:=IndexChar(Sp^,Se-Sp,OldChar);
-  if Ofs<0 then
-    exit(Self);
-  SetLength(Result,Se-Sp);
-  Rp:=PAnsiChar(Pointer(Result));
-
-  repeat
-    Move(Sp^,Rp^,Ofs*sizeof(AnsiChar));
-    Sp:=Sp+Ofs+1;
-    Rp[Ofs]:=NewChar;
-    Rp:=Rp+Ofs+1;
-    if not (rfReplaceAll in ReplaceFlags) then
-      break;
-    { This loop can be removed entirely, but greatly speeds up replacing streaks of characters. }
-    while (Sp<Se) and (Sp^=OldChar) do
-      begin
-        Rp^:=NewChar;
-        Sp:=Sp+1;
-        Rp:=Rp+1;
-      end;
-    Ofs:=IndexChar(Sp^,Se-Sp,OldChar);
-  until Ofs<0;
-  Move(Sp^,Rp^,(Se-Sp)*sizeof(AnsiChar));
-end;
-
-
-function TStringHelper.Replace(const OldValue: string; const NewValue: string
-  ): string;
-begin
-  Result:=Replace(OldValue,NewValue,[rfReplaceAll]);
-end;
-
-
-function TStringHelper.Replace(const OldValue: string; const NewValue: string;
-  ReplaceFlags: TReplaceFlags): string;
-begin
-  Result:=StringReplace(Self,OldValue,NewValue,ReplaceFlags);
-end;
-
-
-function TStringHelper.Split(const Separators: array of AnsiChar): TStringArray;
-begin
-  Result:=Split(Separators,#0,#0,Length+1,TStringSplitOptions.None);
-end;
-
-
-function TStringHelper.Split(const Separators: array of AnsiChar; ACount: SizeInt
-  ): TStringArray;
-begin
-  Result:=Split(Separators,#0,#0,ACount,TStringSplitOptions.None);
-end;
-
-
-function TStringHelper.Split(const Separators: array of AnsiChar;
-  Options: TStringSplitOptions): TStringArray;
-begin
-  Result:=Split(Separators,Length+1,Options);
-end;
-
-
-function TStringHelper.Split(const Separators: array of AnsiChar; ACount: SizeInt;
-  Options: TStringSplitOptions): TStringArray;
-begin
-  Result:=Split(Separators,#0,#0,ACount,Options);
-end;
-
-
-function TStringHelper.Split(const Separators: array of string): TStringArray;
-begin
-  Result:=Split(Separators,Length+1);
-end;
-
-
-function TStringHelper.Split(const Separators: array of string; ACount: SizeInt
-  ): TStringArray;
-begin
-  Result:=Split(Separators,ACount,TStringSplitOptions.None);
-end;
-
-
-function TStringHelper.Split(const Separators: array of string;
-  Options: TStringSplitOptions): TStringArray;
-begin
-  Result:=Split(Separators,Length+1,Options);
-end;
-
-
-function TStringHelper.Split(const Separators: array of string;
-  ACount: SizeInt; Options: TStringSplitOptions): TStringArray;
-begin
-  Result:=Split(Separators,#0,#0,ACount,Options);
-end;
-
-
-function TStringHelper.Split(const Separators: array of AnsiChar; AQuote: AnsiChar
-  ): TStringArray;
-begin
-  Result:=Split(Separators,AQuote,AQuote);
-end;
-
-
-function TStringHelper.Split(const Separators: array of AnsiChar; AQuoteStart,
-  AQuoteEnd: AnsiChar): TStringArray;
-begin
-  Result:=Split(Separators,AQuoteStart,AQuoteEnd,TStringSplitOptions.None);
-end;
-
-
-function TStringHelper.Split(const Separators: array of AnsiChar; AQuoteStart,
-  AQuoteEnd: AnsiChar; Options: TStringSplitOptions): TStringArray;
-begin
-  Result:=Split(Separators,AQuoteStart,AQuoteEnd,Length+1,Options);
-end;
-
-
-function TStringHelper.Split(const Separators: array of AnsiChar; AQuoteStart,
-  AQuoteEnd: AnsiChar; ACount: SizeInt): TStringArray;
-begin
-  Result:=Split(Separators,AQuoteStart,AQuoteEnd,ACount,TStringSplitOptions.None);
-end;
-
-
-function TStringHelper.Split(const Separators: array of AnsiChar; AQuoteStart,
-  AQuoteEnd: AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TStringArray;
-
-  Function NextSep(StartIndex : SizeInt) : SizeInt;
-
-  begin
-    if (AQuoteStart<>#0) then
-      Result:=Self.IndexOfAnyUnQuoted(Separators,AQuoteStart,AQuoteEnd,StartIndex)
-    else
-      Result:=Self.IndexOfAny(Separators,StartIndex);
-  end;
-
-  Procedure MaybeGrow(Curlen : SizeInt);
-
-  begin
-    if System.Length(Result)<=CurLen then
-      SetLength(Result,System.Length(Result)+4+SizeInt(SizeUint(System.Length(Result)) div 4));
-  end;
-
-Var
-  Sep,LastSep,Len : SizeInt;
-
-begin
-  Result:=nil;
-  Len:=0;
-  LastSep:=0;
-  While ((ACount=0) or (Len<ACount)) and (LastSep<=System.Length(Self)) do
-    begin
-    Sep:=NextSep(LastSep);
-    if Sep<0 then
-      Sep:=System.Length(Self);
-//    Writeln('Examining >',T,'< at pos ',LastSep,', till pos ',Sep);
-    If (Sep>LastSep) or (not (TStringSplitOptions.ExcludeEmpty=Options)) then
-      begin
-      MaybeGrow(Len);
-      Result[Len]:=SubString(LastSep,Sep-LastSep);
-      Inc(Len);
-      end;
-    LastSep:=Sep+1;
-    end;
-
-  if (TStringSplitOptions.ExcludeLastEmpty=Options) then
-    if (Len > 0) and (Result[Len-1] = '') then
-      dec(Len);
-
-  SetLength(Result,Len);
-end;
-
-
-function TStringHelper.Split(const Separators: array of string; AQuote: AnsiChar
-  ): TStringArray;
-begin
-  Result:=SPlit(Separators,AQuote,AQuote);
-end;
-
-
-function TStringHelper.Split(const Separators: array of string; AQuoteStart,
-  AQuoteEnd: AnsiChar): TStringArray;
-begin
-  Result:=SPlit(Separators,AQuoteStart,AQuoteEnd,Length+1,TStringSplitOptions.None);
-end;
-
-
-function TStringHelper.Split(const Separators: array of string; AQuoteStart,
-  AQuoteEnd: AnsiChar; Options: TStringSplitOptions): TStringArray;
-begin
-  Result:=SPlit(Separators,AQuoteStart,AQuoteEnd,Length+1,Options);
-end;
-
-
-function TStringHelper.Split(const Separators: array of string; AQuoteStart,
-  AQuoteEnd: AnsiChar; ACount: SizeInt): TStringArray;
-begin
-  Result:=SPlit(Separators,AQuoteStart,AQuoteEnd,ACount,TStringSplitOptions.None);
-end;
-
-
-function TStringHelper.Split(const Separators: array of string; AQuoteStart,
-  AQuoteEnd: AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TStringArray;
-Const
-  BlockSize = 10;
-
-  Function NextSep(StartIndex : SizeInt; out Match : SizeInt) : SizeInt;
-
-  begin
-    if (AQuoteStart<>#0) then
-      Result:=Self.IndexOfAnyUnQuoted(Separators,AQuoteStart,AQuoteEnd,StartIndex,Match)
-    else
-      Result:=Self.IndexOfAny(Separators,StartIndex,Length,Match);
-    if Result<>-1 then
-  end;
-
-  Procedure MaybeGrow(Curlen : SizeInt);
-
-  begin
-    if System.Length(Result)<=CurLen then
-      SetLength(Result,System.Length(Result)+BlockSize);
-  end;
-
-Var
-  Sep,LastSep,Len,Match : SizeInt;
-  T : String;
-
-begin
-  SetLength(Result,BlockSize);
-  Len:=0;
-  LastSep:=0;
-  Sep:=NextSep(0,Match);
-  While (Sep<>-1) and ((ACount=0) or (Len<ACount)) do
-    begin
-    T:=SubString(LastSep,Sep-LastSep);
-    If (T<>'') or (not (TStringSplitOptions.ExcludeEmpty=Options)) then
-      begin
-      MaybeGrow(Len);
-      Result[Len]:=T;
-      Inc(Len);
-      end;
-    LastSep:=Sep+System.Length(Separators[Match]);
-    Sep:=NextSep(LastSep,Match);
-    end;
-  if (LastSep<=Length) and ((ACount=0) or (Len<ACount)) then
-    begin
-    T:=SubString(LastSep);
-//    Writeln('Examining >',T,'< at pos,',LastSep,' till pos ',Sep);
-    If (T<>'') or (not (TStringSplitOptions.ExcludeEmpty=Options)) then
-      begin
-      MaybeGrow(Len);
-      Result[Len]:=T;
-      Inc(Len);
-      end;
-    end;
-
-  If (TStringSplitOptions.ExcludeLastEmpty=Options) then
-    if (Len > 0) and (Result[Len-1] = '') then
-      dec(Len);
-
-  SetLength(Result,Len);
-end;
-
-
-function TStringHelper.StartsWith(const AValue: string): Boolean;
-begin
-  Result:=StartsWith(AValue,False);
-end;
-
-
-function TStringHelper.StartsWith(const AValue: string; IgnoreCase: Boolean
-  ): Boolean;
-Var
-  L : SizeInt;
-
-begin
-  L:=System.Length(AValue);
-  Result:=L<=System.Length(Self);
-  if Result then
-    if IgnoreCase then
-      Result:=SameText(System.Copy(Self,1,L),AValue)
-    else
-      Result:=CompareChar(PAnsiChar(Pointer(Self))^,PAnsiChar(Pointer(AValue))^,L)=0;
-end;
-
-
-function TStringHelper.Substring(AStartIndex: SizeInt): string;
-begin
-  Result:=Self.SubString(AStartIndex,Self.Length-AStartIndex);
-end;
-
-
-function TStringHelper.Substring(AStartIndex: SizeInt; ALen: SizeInt): string;
-begin
-  Result:=system.Copy(Self,AStartIndex+1,ALen);
-end;
-
-
-function TStringHelper.ToBoolean: Boolean;
-begin
-  Result:=StrToBool(Self);
-end;
-
-
-function TStringHelper.ToInteger: Integer;
-begin
-  Result:=StrToInt(Self);
-end;
-
-
-function TStringHelper.ToInt64: Int64;
-begin
-  Result:=StrToInt64(Self);
-end;
-
-
-function TStringHelper.ToSingle: Single;
-begin
-  Result:=StrToFLoat(Self);
-end;
-
-
-function TStringHelper.ToDouble: Double;
-begin
-  Result:=StrToFLoat(Self);
-end;
-
-
-function TStringHelper.ToExtended: Extended;
-begin
-  Result:=StrToFLoat(Self);
-end;
-
-
-function TStringHelper.ToCharArray: TCharArray;
-
-begin
-  Result:=ToCharArray(0,Self.Length);
-end;
-
-
-function TStringHelper.ToCharArray(AStartIndex: SizeInt; ALen: SizeInt
-  ): TCharArray;
-
-Var
-  I : SizeInt;
-
-begin
-  SetLength(Result,ALen);
-  For I:=0 to ALen-1 do
-    Result[I]:=Self[AStartIndex+I+1];
-end;
-
-
-function TStringHelper.ToLower: string;
-begin
-  Result:=LowerCase(Self);
-end;
-
-
-function TStringHelper.ToLowerInvariant: string;
-begin
-  Result:=LowerCase(Self);
-end;
-
-
-function TStringHelper.ToUpper: string;
-begin
-  Result:=UpperCase(Self);
-end;
-
-
-function TStringHelper.ToUpperInvariant: string;
-begin
-  Result:=UpperCase(Self);
-end;
-
-
-function TStringHelper.Trim: string;
-begin
-  Result:=SysUtils.Trim(Self);
-end;
-
-
-function TStringHelper.TrimLeft: string;
-begin
-  Result:=SysUtils.TrimLeft(Self);
-end;
-
-
-function TStringHelper.TrimRight: string;
-begin
-  Result:=SysUtils.TrimRight(Self);
-end;
-
-
-function TStringHelper.Trim(const ATrimChars: array of AnsiChar): string;
-begin
-  Result:=Self.TrimLeft(ATrimChars).TrimRight(ATrimChars);
-end;
-
-
-function TStringHelper.TrimLeft(const ATrimChars: array of AnsiChar): string;
-
-Var
-  I,Len : SizeInt;
-
-begin
-  I:=1;
-  Len:=Self.Length;
-  While (I<=Len) and HaveChar(Self[i],ATrimChars) do Inc(I);
-  if I=1 then
-    Result:=Self
-  else if I>Len then
-    Result:=''
-  else
-    Result:=system.Copy(Self,I,Len-I+1);
-end;
-
-
-function TStringHelper.TrimRight(const ATrimChars: array of AnsiChar): string;
-
-Var
-  I,Len : SizeInt;
-
-begin
-  Len:=Self.Length;
-  I:=Len;
-  While (I>=1) and HaveChar(Self[i],ATrimChars) do Dec(I);
-  if I<1 then
-    Result:=''
-  else if I=Len then
-    Result:=Self
-  else
-    Result:=system.Copy(Self,1,I);
-end;
-
-
-function TStringHelper.TrimEnd(const ATrimChars: array of AnsiChar): string;
-begin
-  Result:=TrimRight(ATrimChars);
-end;
-
-
-function TStringHelper.TrimStart(const ATrimChars: array of AnsiChar): string;
-begin
-  Result:=TrimLeft(ATrimChars);
-end;
 
 { ---------------------------------------------------------------------
   TCurrencyHelper

+ 537 - 105
rtl/objpas/sysutils/syshelph.inc

@@ -1,7 +1,11 @@
-{%mainunit syshelpers.pp}
+{%MainUnit sysutils.pp}
 
 Type
   TStringArray = Array of string;
+  TAnsiStringArray = Array of Ansistring;
+  TUnicodeStringArray = Array of UnicodeString;
+  TWideStringArray = Array of WideString;
+  TShortStringArray = Array of ShortString;
   TCharArray = Array of AnsiChar;
   TEndian = ObjPas.TEndian;
   TByteBitIndex = 0..7;
@@ -60,124 +64,124 @@ Type
   TStringSplitOptions = (None, ExcludeEmpty, ExcludeLastEmpty);
 {$SCOPEDENUMS OFF}
 
-  { TStringHelper }
+  { TAnsiStringHelper }
 
-  TStringHelper = Type Helper for AnsiString
+  TAnsiStringHelper = Type Helper for AnsiString
   Private
     Function GetChar(AIndex : SizeInt) : AnsiChar;
     Function GetLength : SizeInt;
   public
     const Empty = '';
     // Methods
-    Class Function Compare(const A: string; const B: string): Integer; overload; static; //inline;
-    Class Function Compare(const A: string; const B: string; IgnoreCase: Boolean): Integer; overload; static; //inline; //deprecated 'Use same with TCompareOptions';
-    Class Function Compare(const A: string; const B: string; Options: TCompareOptions): Integer; overload; static; // inline;
-    Class Function Compare(const A: string; IndexA: SizeInt; const B: string; IndexB: SizeInt; ALen: SizeInt): Integer; overload; static; // inline;
-    Class Function Compare(const A: string; IndexA: SizeInt; const B: string; IndexB: SizeInt; ALen: SizeInt; IgnoreCase: Boolean): Integer; overload; static; // inline; //deprecated 'Use same with TCompareOptions';
-    Class Function Compare(const A: string; IndexA: SizeInt; const B: string; IndexB: SizeInt; ALen: SizeInt; Options: TCompareOptions): Integer; overload; static;//  inline;
-    Class Function CompareOrdinal(const A: string; const B: string): Integer; overload; static;
-    Class Function CompareOrdinal(const A: string; IndexA: SizeInt; const B: string; IndexB: SizeInt; ALen: SizeInt): Integer; overload; static;
-    Class Function CompareText(const A: string; const B: string): Integer; static; inline;
-    Class Function Copy(const Str: string): string; inline; static;
-    Class Function Create(AChar: AnsiChar; ACount: SizeInt): string; overload; inline; static;
-    Class Function Create(const AValue: array of AnsiChar): string; overload; static;
-    Class Function Create(const AValue: array of AnsiChar; StartIndex: SizeInt; ALen: SizeInt): string; overload; static;
-    Class Function EndsText(const ASubText, AText: string): Boolean; static;
-    Class Function Equals(const a: string; const b: string): Boolean; overload; static;
-    Class Function Format(const AFormat: string; const args: array of const): string; overload; static;
-    Class Function IsNullOrEmpty(const AValue: string): Boolean; static;
-    Class Function IsNullOrWhiteSpace(const AValue: string): Boolean; static;
-    Class Function Join(const Separator: string; const Values: array of const): string; overload; static;
-    Class Function Join(const Separator: string; const Values: array of string): string; overload; static;
-    Class Function Join(const Separator: string; const Values: array of string; StartIndex: SizeInt; ACount: SizeInt): string; overload; static;
-    Class Function LowerCase(const S: string): string; overload; static; inline;
-    Class Function Parse(const AValue: Boolean): string; overload; static; inline;
-    Class Function Parse(const AValue: Extended): string; overload; static;inline;
-    Class Function Parse(const AValue: Int64): string; overload; static; inline;
-    Class Function Parse(const AValue: Integer): string; overload; static; inline;
-    Class Function ToBoolean(const S: string): Boolean; overload; static; inline;
-    Class Function ToDouble(const S: string): Double; overload; static; inline;
-    Class Function ToExtended(const S: string): Extended; overload; static; inline;
-    Class Function ToInt64(const S: string): Int64; overload; static; inline;
-    Class Function ToInteger(const S: string): Integer; overload; static; inline;
-    Class Function ToSingle(const S: string): Single; overload; static; inline;
-    Class Function UpperCase(const S: string): string; overload; static; inline;
-    Function CompareTo(const B: string): Integer;
-    Function Contains(const AValue: string; IgnoreCase: Boolean = False): Boolean;
+    Class Function Compare(const A: AnsiString; const B: AnsiString): Integer; overload; static; //inline;
+    Class Function Compare(const A: AnsiString; const B: AnsiString; IgnoreCase: Boolean): Integer; overload; static; //inline; //deprecated 'Use same with TCompareOptions';
+    Class Function Compare(const A: AnsiString; const B: AnsiString; Options: TCompareOptions): Integer; overload; static; // inline;
+    Class Function Compare(const A: AnsiString; IndexA: SizeInt; const B: AnsiString; IndexB: SizeInt; ALen: SizeInt): Integer; overload; static; // inline;
+    Class Function Compare(const A: AnsiString; IndexA: SizeInt; const B: AnsiString; IndexB: SizeInt; ALen: SizeInt; IgnoreCase: Boolean): Integer; overload; static; // inline; //deprecated 'Use same with TCompareOptions';
+    Class Function Compare(const A: AnsiString; IndexA: SizeInt; const B: AnsiString; IndexB: SizeInt; ALen: SizeInt; Options: TCompareOptions): Integer; overload; static;//  inline;
+    Class Function CompareOrdinal(const A: AnsiString; const B: AnsiString): Integer; overload; static;
+    Class Function CompareOrdinal(const A: AnsiString; IndexA: SizeInt; const B: AnsiString; IndexB: SizeInt; ALen: SizeInt): Integer; overload; static;
+    Class Function CompareText(const A: AnsiString; const B: AnsiString): Integer; static; inline;
+    Class Function Copy(const Str: AnsiString): AnsiString; inline; static;
+    Class Function Create(AChar: AnsiChar; ACount: SizeInt): AnsiString; overload; inline; static;
+    Class Function Create(const AValue: array of AnsiChar): AnsiString; overload; static;
+    Class Function Create(const AValue: array of AnsiChar; StartIndex: SizeInt; ALen: SizeInt): AnsiString; overload; static;
+    Class Function EndsText(const ASubText, AText: AnsiString): Boolean; static;
+    Class Function Equals(const a: AnsiString; const b: AnsiString): Boolean; overload; static;
+    Class Function Format(const AFormat: AnsiString; const args: array of const): AnsiString; overload; static;
+    Class Function IsNullOrEmpty(const AValue: AnsiString): Boolean; static;
+    Class Function IsNullOrWhiteSpace(const AValue: AnsiString): Boolean; static;
+    Class Function Join(const Separator: AnsiString; const Values: array of const): AnsiString; overload; static;
+    Class Function Join(const Separator: AnsiString; const Values: array of AnsiString): AnsiString; overload; static;
+    Class Function Join(const Separator: AnsiString; const Values: array of AnsiString; StartIndex: SizeInt; ACount: SizeInt): AnsiString; overload; static;
+    Class Function LowerCase(const S: AnsiString): AnsiString; overload; static; inline;
+    Class Function Parse(const AValue: Boolean): AnsiString; overload; static; inline;
+    Class Function Parse(const AValue: Extended): AnsiString; overload; static;inline;
+    Class Function Parse(const AValue: Int64): AnsiString; overload; static; inline;
+    Class Function Parse(const AValue: Integer): AnsiString; overload; static; inline;
+    Class Function ToBoolean(const S: AnsiString): Boolean; overload; static; inline;
+    Class Function ToDouble(const S: AnsiString): Double; overload; static; inline;
+    Class Function ToExtended(const S: AnsiString): Extended; overload; static; inline;
+    Class Function ToInt64(const S: AnsiString): Int64; overload; static; inline;
+    Class Function ToInteger(const S: AnsiString): Integer; overload; static; inline;
+    Class Function ToSingle(const S: AnsiString): Single; overload; static; inline;
+    Class Function UpperCase(const S: AnsiString): AnsiString; overload; static; inline;
+    Function CompareTo(const B: AnsiString): Integer;
+    Function Contains(const AValue: AnsiString; IgnoreCase: Boolean = False): Boolean;
     procedure CopyTo(SourceIndex: SizeInt; var destination: array of AnsiChar; DestinationIndex: SizeInt; ACount: SizeInt);
     Function CountChar(const C: AnsiChar): SizeInt;
-    Function DeQuotedString: string; overload;
-    Function DeQuotedString(const AQuoteChar: AnsiChar): string; overload;
-    Function EndsWith(const AValue: string): Boolean; overload; inline;
-    Function EndsWith(const AValue: string; IgnoreCase: Boolean): Boolean; overload;
-    Function Equals(const AValue: string; IgnoreCase: Boolean = False): Boolean; overload;
-    Function Format(const args: array of const): string; overload;
+    Function DeQuotedString: AnsiString; overload;
+    Function DeQuotedString(const AQuoteChar: AnsiChar): AnsiString; overload;
+    Function EndsWith(const AValue: AnsiString): Boolean; overload; inline;
+    Function EndsWith(const AValue: AnsiString; IgnoreCase: Boolean): Boolean; overload;
+    Function Equals(const AValue: AnsiString; IgnoreCase: Boolean = False): Boolean; overload;
+    Function Format(const args: array of const): AnsiString; overload;
     Function GetHashCode: Integer;
     Function IndexOf(AValue: AnsiChar): SizeInt; overload; inline;
-    Function IndexOf(const AValue: string): SizeInt; overload; inline;
+    Function IndexOf(const AValue: AnsiString): SizeInt; overload; inline;
     Function IndexOf(AValue: AnsiChar; StartIndex: SizeInt): SizeInt; overload;
-    Function IndexOf(const AValue: string; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOf(const AValue: AnsiString; StartIndex: SizeInt): SizeInt; overload;
     Function IndexOf(AValue: AnsiChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
-    Function IndexOf(const AValue: string; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
-    Function IndexOfUnQuoted(const AValue: string; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt = 0): SizeInt; overload;
+    Function IndexOf(const AValue: AnsiString; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function IndexOfUnQuoted(const AValue: AnsiString; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt = 0): SizeInt; overload;
     Function IndexOfAny(const AnyOf: array of AnsiChar): SizeInt; overload;
     Function IndexOfAny(const AnyOf: array of AnsiChar; StartIndex: SizeInt): SizeInt; overload;
     Function IndexOfAny(const AnyOf: array of AnsiChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
-    Function IndexOfAny(const AnyOf: array of String): SizeInt; overload;
-    Function IndexOfAny(const AnyOf: array of String; StartIndex: SizeInt): SizeInt; overload;
-    Function IndexOfAny(const AnyOf: array of String; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
-    Function IndexOfAny(const AnyOf: array of String; StartIndex: SizeInt; ACount: SizeInt; Out AMatch : SizeInt): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of AnsiString): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of AnsiString; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of AnsiString; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of AnsiString; StartIndex: SizeInt; ACount: SizeInt; Out AMatch : SizeInt): SizeInt; overload;
     Function IndexOfAnyUnquoted(const AnyOf: array of AnsiChar; StartQuote, EndQuote: AnsiChar): SizeInt; overload;
     Function IndexOfAnyUnquoted(const AnyOf: array of AnsiChar; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt): SizeInt; overload;
     Function IndexOfAnyUnquoted(const AnyOf: array of AnsiChar; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
-    function IndexOfAnyUnquoted(const AnyOf: array of string; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt; Out Matched: SizeInt): SizeInt; overload;
-    Function Insert(StartIndex: SizeInt; const AValue: string): string;
-    Function IsDelimiter(const Delimiters: string; Index: SizeInt): Boolean;
+    function IndexOfAnyUnquoted(const AnyOf: array of AnsiString; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt; Out Matched: SizeInt): SizeInt; overload;
+    Function Insert(StartIndex: SizeInt; const AValue: AnsiString): AnsiString;
+    Function IsDelimiter(const Delimiters: AnsiString; Index: SizeInt): Boolean;
     Function IsEmpty: Boolean;
-    Function LastDelimiter(const Delims: string): SizeInt;
+    Function LastDelimiter(const Delims: AnsiString): SizeInt;
     Function LastIndexOf(AValue: AnsiChar): SizeInt; overload;
-    Function LastIndexOf(const AValue: string): SizeInt; overload;
+    Function LastIndexOf(const AValue: AnsiString): SizeInt; overload;
     Function LastIndexOf(AValue: AnsiChar; AStartIndex: SizeInt): SizeInt; overload;
-    Function LastIndexOf(const AValue: string; AStartIndex: SizeInt): SizeInt; overload;
+    Function LastIndexOf(const AValue: AnsiString; AStartIndex: SizeInt): SizeInt; overload;
     Function LastIndexOf(AValue: AnsiChar; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
-    Function LastIndexOf(const AValue: string; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function LastIndexOf(const AValue: AnsiString; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
     Function LastIndexOfAny(const AnyOf: array of AnsiChar): SizeInt; overload;
     Function LastIndexOfAny(const AnyOf: array of AnsiChar; AStartIndex: SizeInt): SizeInt; overload;
     Function LastIndexOfAny(const AnyOf: array of AnsiChar; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
-    Function PadLeft(ATotalWidth: SizeInt): string; overload; inline;
-    Function PadLeft(ATotalWidth: SizeInt; PaddingChar: AnsiChar): string; overload; inline;
-    Function PadRight(ATotalWidth: SizeInt): string; overload; inline;
-    Function PadRight(ATotalWidth: SizeInt; PaddingChar: AnsiChar): string; overload; inline;
-    Function QuotedString: string; overload;
-    Function QuotedString(const AQuoteChar: AnsiChar): string; overload;
-    Function Remove(StartIndex: SizeInt): string; overload; inline;
-    Function Remove(StartIndex: SizeInt; ACount: SizeInt): string; overload; inline;
-    Function Replace(OldChar: AnsiChar; NewChar: AnsiChar): string; overload;
-    Function Replace(OldChar: AnsiChar; NewChar: AnsiChar; ReplaceFlags: TReplaceFlags): string; overload;
-    Function Replace(const OldValue: string; const NewValue: string): string; overload;
-    Function Replace(const OldValue: string; const NewValue: string; ReplaceFlags: TReplaceFlags): string; overload;
-    Function Split(const Separators: array of AnsiChar): TStringArray; overload;
-    Function Split(const Separators: array of AnsiChar; ACount: SizeInt): TStringArray; overload;
-    Function Split(const Separators: array of AnsiChar; Options: TStringSplitOptions): TStringArray; overload;
-    Function Split(const Separators: array of AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TStringArray; overload;
-    Function Split(const Separators: array of string): TStringArray; overload;
-    Function Split(const Separators: array of string; ACount: SizeInt): TStringArray; overload;
-    Function Split(const Separators: array of string; Options: TStringSplitOptions): TStringArray; overload;
-    Function Split(const Separators: array of string; ACount: SizeInt; Options: TStringSplitOptions): TStringArray; overload;
-    Function Split(const Separators: array of AnsiChar; AQuote: AnsiChar): TStringArray; overload;
-    Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar): TStringArray; overload;
-    Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar; Options: TStringSplitOptions): TStringArray; overload;
-    Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt): TStringArray; overload;
-    Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TStringArray; overload;
-    Function Split(const Separators: array of string; AQuote: AnsiChar): TStringArray; overload;
-    Function Split(const Separators: array of string; AQuoteStart, AQuoteEnd: AnsiChar): TStringArray; overload;
-    Function Split(const Separators: array of string; AQuoteStart, AQuoteEnd: AnsiChar; Options: TStringSplitOptions): TStringArray; overload;
-    Function Split(const Separators: array of string; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt): TStringArray; overload;
-    Function Split(const Separators: array of string; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TStringArray; overload;
-    Function StartsWith(const AValue: string): Boolean; overload; inline;
-    Function StartsWith(const AValue: string; IgnoreCase: Boolean): Boolean; overload;
-    Function Substring(AStartIndex: SizeInt): string; overload;
-    Function Substring(AStartIndex: SizeInt; ALen: SizeInt): string; overload;
+    Function PadLeft(ATotalWidth: SizeInt): AnsiString; overload; inline;
+    Function PadLeft(ATotalWidth: SizeInt; PaddingChar: AnsiChar): AnsiString; overload; inline;
+    Function PadRight(ATotalWidth: SizeInt): AnsiString; overload; inline;
+    Function PadRight(ATotalWidth: SizeInt; PaddingChar: AnsiChar): AnsiString; overload; inline;
+    Function QuotedString: AnsiString; overload;
+    Function QuotedString(const AQuoteChar: AnsiChar): AnsiString; overload;
+    Function Remove(StartIndex: SizeInt): AnsiString; overload; inline;
+    Function Remove(StartIndex: SizeInt; ACount: SizeInt): AnsiString; overload; inline;
+    Function Replace(OldChar: AnsiChar; NewChar: AnsiChar): AnsiString; overload;
+    Function Replace(OldChar: AnsiChar; NewChar: AnsiChar; ReplaceFlags: TReplaceFlags): AnsiString; overload;
+    Function Replace(const OldValue: AnsiString; const NewValue: AnsiString): AnsiString; overload;
+    Function Replace(const OldValue: AnsiString; const NewValue: AnsiString; ReplaceFlags: TReplaceFlags): AnsiString; overload;
+    Function Split(const Separators: array of AnsiChar): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; ACount: SizeInt): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; Options: TStringSplitOptions): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiString): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiString; ACount: SizeInt): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiString; Options: TStringSplitOptions): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiString; ACount: SizeInt; Options: TStringSplitOptions): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; AQuote: AnsiChar): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar; Options: TStringSplitOptions): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiString; AQuote: AnsiChar): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiString; AQuoteStart, AQuoteEnd: AnsiChar): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiString; AQuoteStart, AQuoteEnd: AnsiChar; Options: TStringSplitOptions): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiString; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt): TAnsiStringArray; overload;
+    Function Split(const Separators: array of AnsiString; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TAnsiStringArray; overload;
+    Function StartsWith(const AValue: AnsiString): Boolean; overload; inline;
+    Function StartsWith(const AValue: AnsiString; IgnoreCase: Boolean): Boolean; overload;
+    Function Substring(AStartIndex: SizeInt): AnsiString; overload;
+    Function Substring(AStartIndex: SizeInt; ALen: SizeInt): AnsiString; overload;
     Function ToBoolean: Boolean; overload; inline;
     Function ToInteger: Integer; overload; inline;
     Function ToInt64: Int64; overload; inline;
@@ -186,18 +190,18 @@ Type
     Function ToExtended: Extended; overload; inline;
     Function ToCharArray: TCharArray; overload;
     Function ToCharArray(AStartIndex: SizeInt; ALen: SizeInt): TCharArray; overload;
-    Function ToLower: string; overload; inline;
-    Function ToLowerInvariant: string;
-    Function ToUpper: string; overload; inline;
-    Function ToUpperInvariant: string; inline;
-    Function Trim: string; overload;
-    Function TrimLeft: string; overload;
-    Function TrimRight: string; overload;
-    Function Trim(const ATrimChars: array of AnsiChar): string; overload;
-    Function TrimLeft(const ATrimChars: array of AnsiChar): string; overload;
-    Function TrimRight(const ATrimChars: array of AnsiChar): string; overload;
-    Function TrimEnd(const ATrimChars: array of AnsiChar): string; deprecated 'Use TrimRight';
-    Function TrimStart(const ATrimChars: array of AnsiChar): string; deprecated 'Use TrimLeft';
+    Function ToLower: AnsiString; overload; inline;
+    Function ToLowerInvariant: AnsiString;
+    Function ToUpper: AnsiString; overload; inline;
+    Function ToUpperInvariant: AnsiString; inline;
+    Function Trim: AnsiString; overload;
+    Function TrimLeft: AnsiString; overload;
+    Function TrimRight: AnsiString; overload;
+    Function Trim(const ATrimChars: array of AnsiChar): AnsiString; overload;
+    Function TrimLeft(const ATrimChars: array of AnsiChar): AnsiString; overload;
+    Function TrimRight(const ATrimChars: array of AnsiChar): AnsiString; overload;
+    Function TrimEnd(const ATrimChars: array of AnsiChar): AnsiString; deprecated 'Use TrimRight';
+    Function TrimStart(const ATrimChars: array of AnsiChar): AnsiString; deprecated 'Use TrimLeft';
     property Chars[AIndex: SizeInt]: AnsiChar read GetChar;
     property Length: SizeInt read GetLength;
   end;
@@ -225,6 +229,434 @@ Type
     property MinValue: Currency read GetMinValue;
   end;
 
+  { TWideStringHelper }
+
+  TWideStringHelper = Type Helper for WideString
+  Private
+    Function GetChar(AIndex : SizeInt) : WideChar;
+    Function GetLength : SizeInt;
+  public
+    const Empty = '';
+    // Methods
+    Class Function Compare(const A: WideString; const B: WideString): Integer; overload; static; //inline;
+    Class Function Compare(const A: WideString; const B: WideString; IgnoreCase: Boolean): Integer; overload; static; //inline; //deprecated 'Use same with TCompareOptions';
+    Class Function Compare(const A: WideString; const B: WideString; Options: TCompareOptions): Integer; overload; static; // inline;
+    Class Function Compare(const A: WideString; IndexA: SizeInt; const B: WideString; IndexB: SizeInt; ALen: SizeInt): Integer; overload; static; // inline;
+    Class Function Compare(const A: WideString; IndexA: SizeInt; const B: WideString; IndexB: SizeInt; ALen: SizeInt; IgnoreCase: Boolean): Integer; overload; static; // inline; //deprecated 'Use same with TCompareOptions';
+    Class Function Compare(const A: WideString; IndexA: SizeInt; const B: WideString; IndexB: SizeInt; ALen: SizeInt; Options: TCompareOptions): Integer; overload; static;//  inline;
+    Class Function CompareOrdinal(const A: WideString; const B: WideString): Integer; overload; static;
+    Class Function CompareOrdinal(const A: WideString; IndexA: SizeInt; const B: WideString; IndexB: SizeInt; ALen: SizeInt): Integer; overload; static;
+    Class Function CompareText(const A: WideString; const B: WideString): Integer; static; inline;
+    Class Function Copy(const Str: WideString): WideString; inline; static;
+    Class Function Create(AChar: WideChar; ACount: SizeInt): WideString; overload; inline; static;
+    Class Function Create(const AValue: array of WideChar): WideString; overload; static;
+    Class Function Create(const AValue: array of WideChar; StartIndex: SizeInt; ALen: SizeInt): WideString; overload; static;
+    Class Function EndsText(const ASubText, AText: WideString): Boolean; static;
+    Class Function Equals(const a: WideString; const b: WideString): Boolean; overload; static;
+    Class Function Format(const AFormat: WideString; const args: array of const): WideString; overload; static;
+    Class Function IsNullOrEmpty(const AValue: WideString): Boolean; static;
+    Class Function IsNullOrWhiteSpace(const AValue: WideString): Boolean; static;
+    Class Function Join(const Separator: WideString; const Values: array of const): WideString; overload; static;
+    Class Function Join(const Separator: WideString; const Values: array of WideString): WideString; overload; static;
+    Class Function Join(const Separator: WideString; const Values: array of WideString; StartIndex: SizeInt; ACount: SizeInt): WideString; overload; static;
+    Class Function LowerCase(const S: WideString): WideString; overload; static; inline;
+    Class Function Parse(const AValue: Boolean): WideString; overload; static; inline;
+    Class Function Parse(const AValue: Extended): WideString; overload; static;inline;
+    Class Function Parse(const AValue: Int64): WideString; overload; static; inline;
+    Class Function Parse(const AValue: Integer): WideString; overload; static; inline;
+    Class Function ToBoolean(const S: WideString): Boolean; overload; static; inline;
+    Class Function ToDouble(const S: WideString): Double; overload; static; inline;
+    Class Function ToExtended(const S: WideString): Extended; overload; static; inline;
+    Class Function ToInt64(const S: WideString): Int64; overload; static; inline;
+    Class Function ToInteger(const S: WideString): Integer; overload; static; inline;
+    Class Function ToSingle(const S: WideString): Single; overload; static; inline;
+    Class Function UpperCase(const S: WideString): WideString; overload; static; inline;
+    Function CompareTo(const B: WideString): Integer;
+    Function Contains(const AValue: WideString; IgnoreCase: Boolean = False): Boolean;
+    procedure CopyTo(SourceIndex: SizeInt; var destination: array of WideChar; DestinationIndex: SizeInt; ACount: SizeInt);
+    Function CountChar(const C: WideChar): SizeInt;
+    Function DeQuotedString: WideString; overload;
+    Function DeQuotedString(const AQuoteChar: WideChar): WideString; overload;
+    Function EndsWith(const AValue: WideString): Boolean; overload; inline;
+    Function EndsWith(const AValue: WideString; IgnoreCase: Boolean): Boolean; overload;
+    Function Equals(const AValue: WideString; IgnoreCase: Boolean = False): Boolean; overload;
+    Function Format(const args: array of const): WideString; overload;
+    Function GetHashCode: Integer;
+    Function IndexOf(AValue: WideChar): SizeInt; overload; inline;
+    Function IndexOf(const AValue: WideString): SizeInt; overload; inline;
+    Function IndexOf(AValue: WideChar; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOf(const AValue: WideString; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOf(AValue: WideChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function IndexOf(const AValue: WideString; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function IndexOfUnQuoted(const AValue: WideString; StartQuote, EndQuote: WideChar; StartIndex: SizeInt = 0): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of WideChar): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of WideChar; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of WideChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of WideString): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of WideString; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of WideString; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of WideString; StartIndex: SizeInt; ACount: SizeInt; Out AMatch : SizeInt): SizeInt; overload;
+    Function IndexOfAnyUnquoted(const AnyOf: array of WideChar; StartQuote, EndQuote: WideChar): SizeInt; overload;
+    Function IndexOfAnyUnquoted(const AnyOf: array of WideChar; StartQuote, EndQuote: WideChar; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOfAnyUnquoted(const AnyOf: array of WideChar; StartQuote, EndQuote: WideChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    function IndexOfAnyUnquoted(const AnyOf: array of WideString; StartQuote, EndQuote: WideChar; StartIndex: SizeInt; Out Matched: SizeInt): SizeInt; overload;
+    Function Insert(StartIndex: SizeInt; const AValue: WideString): WideString;
+    Function IsDelimiter(const Delimiters: WideString; Index: SizeInt): Boolean;
+    Function IsEmpty: Boolean;
+    Function LastDelimiter(const Delims: WideString): SizeInt;
+    Function LastIndexOf(AValue: WideChar): SizeInt; overload;
+    Function LastIndexOf(const AValue: WideString): SizeInt; overload;
+    Function LastIndexOf(AValue: WideChar; AStartIndex: SizeInt): SizeInt; overload;
+    Function LastIndexOf(const AValue: WideString; AStartIndex: SizeInt): SizeInt; overload;
+    Function LastIndexOf(AValue: WideChar; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function LastIndexOf(const AValue: WideString; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function LastIndexOfAny(const AnyOf: array of WideChar): SizeInt; overload;
+    Function LastIndexOfAny(const AnyOf: array of WideChar; AStartIndex: SizeInt): SizeInt; overload;
+    Function LastIndexOfAny(const AnyOf: array of WideChar; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function PadLeft(ATotalWidth: SizeInt): WideString; overload; inline;
+    Function PadLeft(ATotalWidth: SizeInt; PaddingChar: WideChar): WideString; overload; inline;
+    Function PadRight(ATotalWidth: SizeInt): WideString; overload; inline;
+    Function PadRight(ATotalWidth: SizeInt; PaddingChar: WideChar): WideString; overload; inline;
+    Function QuotedString: WideString; overload;
+    Function QuotedString(const AQuoteChar: WideChar): WideString; overload;
+    Function Remove(StartIndex: SizeInt): WideString; overload; inline;
+    Function Remove(StartIndex: SizeInt; ACount: SizeInt): WideString; overload; inline;
+    Function Replace(OldChar: WideChar; NewChar: WideChar): WideString; overload;
+    Function Replace(OldChar: WideChar; NewChar: WideChar; ReplaceFlags: TReplaceFlags): WideString; overload;
+    Function Replace(const OldValue: WideString; const NewValue: WideString): WideString; overload;
+    Function Replace(const OldValue: WideString; const NewValue: WideString; ReplaceFlags: TReplaceFlags): WideString; overload;
+    Function Split(const Separators: array of WideChar): TWideStringArray; overload;
+    Function Split(const Separators: array of WideChar; ACount: SizeInt): TWideStringArray; overload;
+    Function Split(const Separators: array of WideChar; Options: TStringSplitOptions): TWideStringArray; overload;
+    Function Split(const Separators: array of WideChar; ACount: SizeInt; Options: TStringSplitOptions): TWideStringArray; overload;
+    Function Split(const Separators: array of WideString): TWideStringArray; overload;
+    Function Split(const Separators: array of WideString; ACount: SizeInt): TWideStringArray; overload;
+    Function Split(const Separators: array of WideString; Options: TStringSplitOptions): TWideStringArray; overload;
+    Function Split(const Separators: array of WideString; ACount: SizeInt; Options: TStringSplitOptions): TWideStringArray; overload;
+    Function Split(const Separators: array of WideChar; AQuote: WideChar): TWideStringArray; overload;
+    Function Split(const Separators: array of WideChar; AQuoteStart, AQuoteEnd: WideChar): TWideStringArray; overload;
+    Function Split(const Separators: array of WideChar; AQuoteStart, AQuoteEnd: WideChar; Options: TStringSplitOptions): TWideStringArray; overload;
+    Function Split(const Separators: array of WideChar; AQuoteStart, AQuoteEnd: WideChar; ACount: SizeInt): TWideStringArray; overload;
+    Function Split(const Separators: array of WideChar; AQuoteStart, AQuoteEnd: WideChar; ACount: SizeInt; Options: TStringSplitOptions): TWideStringArray; overload;
+    Function Split(const Separators: array of WideString; AQuote: WideChar): TWideStringArray; overload;
+    Function Split(const Separators: array of WideString; AQuoteStart, AQuoteEnd: WideChar): TWideStringArray; overload;
+    Function Split(const Separators: array of WideString; AQuoteStart, AQuoteEnd: WideChar; Options: TStringSplitOptions): TWideStringArray; overload;
+    Function Split(const Separators: array of WideString; AQuoteStart, AQuoteEnd: WideChar; ACount: SizeInt): TWideStringArray; overload;
+    Function Split(const Separators: array of WideString; AQuoteStart, AQuoteEnd: WideChar; ACount: SizeInt; Options: TStringSplitOptions): TWideStringArray; overload;
+    Function StartsWith(const AValue: WideString): Boolean; overload; inline;
+    Function StartsWith(const AValue: WideString; IgnoreCase: Boolean): Boolean; overload;
+    Function Substring(AStartIndex: SizeInt): WideString; overload;
+    Function Substring(AStartIndex: SizeInt; ALen: SizeInt): WideString; overload;
+    Function ToBoolean: Boolean; overload; inline;
+    Function ToInteger: Integer; overload; inline;
+    Function ToInt64: Int64; overload; inline;
+    Function ToSingle: Single; overload; inline;
+    Function ToDouble: Double; overload; inline;
+    Function ToExtended: Extended; overload; inline;
+    Function ToCharArray: TCharArray; overload;
+    Function ToCharArray(AStartIndex: SizeInt; ALen: SizeInt): TCharArray; overload;
+    Function ToLower: WideString; overload; inline;
+    Function ToLowerInvariant: WideString;
+    Function ToUpper: WideString; overload; inline;
+    Function ToUpperInvariant: WideString; inline;
+    Function Trim: WideString; overload;
+    Function TrimLeft: WideString; overload;
+    Function TrimRight: WideString; overload;
+    Function Trim(const ATrimChars: array of WideChar): WideString; overload;
+    Function TrimLeft(const ATrimChars: array of WideChar): WideString; overload;
+    Function TrimRight(const ATrimChars: array of WideChar): WideString; overload;
+    Function TrimEnd(const ATrimChars: array of WideChar): WideString; deprecated 'Use TrimRight';
+    Function TrimStart(const ATrimChars: array of WideChar): WideString; deprecated 'Use TrimLeft';
+    property Chars[AIndex: SizeInt]: WideChar read GetChar;
+    property Length: SizeInt read GetLength;
+  end;
+
+  { TUnicodeStringHelper }
+
+  TUnicodeStringHelper = Type Helper for UnicodeString
+  Private
+    Function GetChar(AIndex : SizeInt) : UnicodeChar;
+    Function GetLength : SizeInt;
+  public
+    const Empty = '';
+    // Methods
+    Class Function Compare(const A: UnicodeString; const B: UnicodeString): Integer; overload; static; //inline;
+    Class Function Compare(const A: UnicodeString; const B: UnicodeString; IgnoreCase: Boolean): Integer; overload; static; //inline; //deprecated 'Use same with TCompareOptions';
+    Class Function Compare(const A: UnicodeString; const B: UnicodeString; Options: TCompareOptions): Integer; overload; static; // inline;
+    Class Function Compare(const A: UnicodeString; IndexA: SizeInt; const B: UnicodeString; IndexB: SizeInt; ALen: SizeInt): Integer; overload; static; // inline;
+    Class Function Compare(const A: UnicodeString; IndexA: SizeInt; const B: UnicodeString; IndexB: SizeInt; ALen: SizeInt; IgnoreCase: Boolean): Integer; overload; static; // inline; //deprecated 'Use same with TCompareOptions';
+    Class Function Compare(const A: UnicodeString; IndexA: SizeInt; const B: UnicodeString; IndexB: SizeInt; ALen: SizeInt; Options: TCompareOptions): Integer; overload; static;//  inline;
+    Class Function CompareOrdinal(const A: UnicodeString; const B: UnicodeString): Integer; overload; static;
+    Class Function CompareOrdinal(const A: UnicodeString; IndexA: SizeInt; const B: UnicodeString; IndexB: SizeInt; ALen: SizeInt): Integer; overload; static;
+    Class Function CompareText(const A: UnicodeString; const B: UnicodeString): Integer; static; inline;
+    Class Function Copy(const Str: UnicodeString): UnicodeString; inline; static;
+    Class Function Create(AChar: UnicodeChar; ACount: SizeInt): UnicodeString; overload; inline; static;
+    Class Function Create(const AValue: array of UnicodeChar): UnicodeString; overload; static;
+    Class Function Create(const AValue: array of UnicodeChar; StartIndex: SizeInt; ALen: SizeInt): UnicodeString; overload; static;
+    Class Function EndsText(const ASubText, AText: UnicodeString): Boolean; static;
+    Class Function Equals(const a: UnicodeString; const b: UnicodeString): Boolean; overload; static;
+    Class Function Format(const AFormat: UnicodeString; const args: array of const): UnicodeString; overload; static;
+    Class Function IsNullOrEmpty(const AValue: UnicodeString): Boolean; static;
+    Class Function IsNullOrWhiteSpace(const AValue: UnicodeString): Boolean; static;
+    Class Function Join(const Separator: UnicodeString; const Values: array of const): UnicodeString; overload; static;
+    Class Function Join(const Separator: UnicodeString; const Values: array of UnicodeString): UnicodeString; overload; static;
+    Class Function Join(const Separator: UnicodeString; const Values: array of UnicodeString; StartIndex: SizeInt; ACount: SizeInt): UnicodeString; overload; static;
+    Class Function LowerCase(const S: UnicodeString): UnicodeString; overload; static; inline;
+    Class Function Parse(const AValue: Boolean): UnicodeString; overload; static; inline;
+    Class Function Parse(const AValue: Extended): UnicodeString; overload; static;inline;
+    Class Function Parse(const AValue: Int64): UnicodeString; overload; static; inline;
+    Class Function Parse(const AValue: Integer): UnicodeString; overload; static; inline;
+    Class Function ToBoolean(const S: UnicodeString): Boolean; overload; static; inline;
+    Class Function ToDouble(const S: UnicodeString): Double; overload; static; inline;
+    Class Function ToExtended(const S: UnicodeString): Extended; overload; static; inline;
+    Class Function ToInt64(const S: UnicodeString): Int64; overload; static; inline;
+    Class Function ToInteger(const S: UnicodeString): Integer; overload; static; inline;
+    Class Function ToSingle(const S: UnicodeString): Single; overload; static; inline;
+    Class Function UpperCase(const S: UnicodeString): UnicodeString; overload; static; inline;
+    Function CompareTo(const B: UnicodeString): Integer;
+    Function Contains(const AValue: UnicodeString; IgnoreCase: Boolean = False): Boolean;
+    procedure CopyTo(SourceIndex: SizeInt; var destination: array of UnicodeChar; DestinationIndex: SizeInt; ACount: SizeInt);
+    Function CountChar(const C: UnicodeChar): SizeInt;
+    Function DeQuotedString: UnicodeString; overload;
+    Function DeQuotedString(const AQuoteChar: UnicodeChar): UnicodeString; overload;
+    Function EndsWith(const AValue: UnicodeString): Boolean; overload; inline;
+    Function EndsWith(const AValue: UnicodeString; IgnoreCase: Boolean): Boolean; overload;
+    Function Equals(const AValue: UnicodeString; IgnoreCase: Boolean = False): Boolean; overload;
+    Function Format(const args: array of const): UnicodeString; overload;
+    Function GetHashCode: Integer;
+    Function IndexOf(AValue: UnicodeChar): SizeInt; overload; inline;
+    Function IndexOf(const AValue: UnicodeString): SizeInt; overload; inline;
+    Function IndexOf(AValue: UnicodeChar; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOf(const AValue: UnicodeString; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOf(AValue: UnicodeChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function IndexOf(const AValue: UnicodeString; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function IndexOfUnQuoted(const AValue: UnicodeString; StartQuote, EndQuote: UnicodeChar; StartIndex: SizeInt = 0): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of UnicodeChar): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of UnicodeChar; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of UnicodeChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of UnicodeString): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of UnicodeString; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of UnicodeString; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of UnicodeString; StartIndex: SizeInt; ACount: SizeInt; Out AMatch : SizeInt): SizeInt; overload;
+    Function IndexOfAnyUnquoted(const AnyOf: array of UnicodeChar; StartQuote, EndQuote: UnicodeChar): SizeInt; overload;
+    Function IndexOfAnyUnquoted(const AnyOf: array of UnicodeChar; StartQuote, EndQuote: UnicodeChar; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOfAnyUnquoted(const AnyOf: array of UnicodeChar; StartQuote, EndQuote: UnicodeChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    function IndexOfAnyUnquoted(const AnyOf: array of UnicodeString; StartQuote, EndQuote: UnicodeChar; StartIndex: SizeInt; Out Matched: SizeInt): SizeInt; overload;
+    Function Insert(StartIndex: SizeInt; const AValue: UnicodeString): UnicodeString;
+    Function IsDelimiter(const Delimiters: UnicodeString; Index: SizeInt): Boolean;
+    Function IsEmpty: Boolean;
+    Function LastDelimiter(const Delims: UnicodeString): SizeInt;
+    Function LastIndexOf(AValue: UnicodeChar): SizeInt; overload;
+    Function LastIndexOf(const AValue: UnicodeString): SizeInt; overload;
+    Function LastIndexOf(AValue: UnicodeChar; AStartIndex: SizeInt): SizeInt; overload;
+    Function LastIndexOf(const AValue: UnicodeString; AStartIndex: SizeInt): SizeInt; overload;
+    Function LastIndexOf(AValue: UnicodeChar; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function LastIndexOf(const AValue: UnicodeString; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function LastIndexOfAny(const AnyOf: array of UnicodeChar): SizeInt; overload;
+    Function LastIndexOfAny(const AnyOf: array of UnicodeChar; AStartIndex: SizeInt): SizeInt; overload;
+    Function LastIndexOfAny(const AnyOf: array of UnicodeChar; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function PadLeft(ATotalWidth: SizeInt): UnicodeString; overload; inline;
+    Function PadLeft(ATotalWidth: SizeInt; PaddingChar: UnicodeChar): UnicodeString; overload; inline;
+    Function PadRight(ATotalWidth: SizeInt): UnicodeString; overload; inline;
+    Function PadRight(ATotalWidth: SizeInt; PaddingChar: UnicodeChar): UnicodeString; overload; inline;
+    Function QuotedString: UnicodeString; overload;
+    Function QuotedString(const AQuoteChar: UnicodeChar): UnicodeString; overload;
+    Function Remove(StartIndex: SizeInt): UnicodeString; overload; inline;
+    Function Remove(StartIndex: SizeInt; ACount: SizeInt): UnicodeString; overload; inline;
+    Function Replace(OldChar: UnicodeChar; NewChar: UnicodeChar): UnicodeString; overload;
+    Function Replace(OldChar: UnicodeChar; NewChar: UnicodeChar; ReplaceFlags: TReplaceFlags): UnicodeString; overload;
+    Function Replace(const OldValue: UnicodeString; const NewValue: UnicodeString): UnicodeString; overload;
+    Function Replace(const OldValue: UnicodeString; const NewValue: UnicodeString; ReplaceFlags: TReplaceFlags): UnicodeString; overload;
+    Function Split(const Separators: array of UnicodeChar): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeChar; ACount: SizeInt): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeChar; Options: TStringSplitOptions): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeChar; ACount: SizeInt; Options: TStringSplitOptions): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeString): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeString; ACount: SizeInt): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeString; Options: TStringSplitOptions): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeString; ACount: SizeInt; Options: TStringSplitOptions): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeChar; AQuote: UnicodeChar): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeChar; AQuoteStart, AQuoteEnd: UnicodeChar): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeChar; AQuoteStart, AQuoteEnd: UnicodeChar; Options: TStringSplitOptions): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeChar; AQuoteStart, AQuoteEnd: UnicodeChar; ACount: SizeInt): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeChar; AQuoteStart, AQuoteEnd: UnicodeChar; ACount: SizeInt; Options: TStringSplitOptions): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeString; AQuote: UnicodeChar): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeString; AQuoteStart, AQuoteEnd: UnicodeChar): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeString; AQuoteStart, AQuoteEnd: UnicodeChar; Options: TStringSplitOptions): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeString; AQuoteStart, AQuoteEnd: UnicodeChar; ACount: SizeInt): TUnicodeStringArray; overload;
+    Function Split(const Separators: array of UnicodeString; AQuoteStart, AQuoteEnd: UnicodeChar; ACount: SizeInt; Options: TStringSplitOptions): TUnicodeStringArray; overload;
+    Function StartsWith(const AValue: UnicodeString): Boolean; overload; inline;
+    Function StartsWith(const AValue: UnicodeString; IgnoreCase: Boolean): Boolean; overload;
+    Function Substring(AStartIndex: SizeInt): UnicodeString; overload;
+    Function Substring(AStartIndex: SizeInt; ALen: SizeInt): UnicodeString; overload;
+    Function ToBoolean: Boolean; overload; inline;
+    Function ToInteger: Integer; overload; inline;
+    Function ToInt64: Int64; overload; inline;
+    Function ToSingle: Single; overload; inline;
+    Function ToDouble: Double; overload; inline;
+    Function ToExtended: Extended; overload; inline;
+    Function ToCharArray: TCharArray; overload;
+    Function ToCharArray(AStartIndex: SizeInt; ALen: SizeInt): TCharArray; overload;
+    Function ToLower: UnicodeString; overload; inline;
+    Function ToLowerInvariant: UnicodeString;
+    Function ToUpper: UnicodeString; overload; inline;
+    Function ToUpperInvariant: UnicodeString; inline;
+    Function Trim: UnicodeString; overload;
+    Function TrimLeft: UnicodeString; overload;
+    Function TrimRight: UnicodeString; overload;
+    Function Trim(const ATrimChars: array of UnicodeChar): UnicodeString; overload;
+    Function TrimLeft(const ATrimChars: array of UnicodeChar): UnicodeString; overload;
+    Function TrimRight(const ATrimChars: array of UnicodeChar): UnicodeString; overload;
+    Function TrimEnd(const ATrimChars: array of UnicodeChar): UnicodeString; deprecated 'Use TrimRight';
+    Function TrimStart(const ATrimChars: array of UnicodeChar): UnicodeString; deprecated 'Use TrimLeft';
+    property Chars[AIndex: SizeInt]: UnicodeChar read GetChar;
+    property Length: SizeInt read GetLength;
+  end;
+
+    { TShortStringHelper }
+
+    TShortStringHelper = Type Helper for ShortString
+    Private
+      Function GetChar(AIndex : SizeInt) : AnsiChar;
+      Function GetLength : SizeInt;
+    public
+      const Empty = '';
+      // Methods
+      Class Function Compare(const A: ShortString; const B: ShortString): Integer; overload; static; //inline;
+      Class Function Compare(const A: ShortString; const B: ShortString; IgnoreCase: Boolean): Integer; overload; static; //inline; //deprecated 'Use same with TCompareOptions';
+      Class Function Compare(const A: ShortString; const B: ShortString; Options: TCompareOptions): Integer; overload; static; // inline;
+      Class Function Compare(const A: ShortString; IndexA: SizeInt; const B: ShortString; IndexB: SizeInt; ALen: SizeInt): Integer; overload; static; // inline;
+      Class Function Compare(const A: ShortString; IndexA: SizeInt; const B: ShortString; IndexB: SizeInt; ALen: SizeInt; IgnoreCase: Boolean): Integer; overload; static; // inline; //deprecated 'Use same with TCompareOptions';
+      Class Function Compare(const A: ShortString; IndexA: SizeInt; const B: ShortString; IndexB: SizeInt; ALen: SizeInt; Options: TCompareOptions): Integer; overload; static;//  inline;
+      Class Function CompareOrdinal(const A: ShortString; const B: ShortString): Integer; overload; static;
+      Class Function CompareOrdinal(const A: ShortString; IndexA: SizeInt; const B: ShortString; IndexB: SizeInt; ALen: SizeInt): Integer; overload; static;
+      Class Function CompareText(const A: ShortString; const B: ShortString): Integer; static; inline;
+      Class Function Copy(const Str: ShortString): ShortString; inline; static;
+      Class Function Create(AChar: AnsiChar; ACount: SizeInt): ShortString; overload; inline; static;
+      Class Function Create(const AValue: array of AnsiChar): ShortString; overload; static;
+      Class Function Create(const AValue: array of AnsiChar; StartIndex: SizeInt; ALen: SizeInt): ShortString; overload; static;
+      Class Function EndsText(const ASubText, AText: ShortString): Boolean; static;
+      Class Function Equals(const a: ShortString; const b: ShortString): Boolean; overload; static;
+      Class Function Format(const AFormat: ShortString; const args: array of const): ShortString; overload; static;
+      Class Function IsNullOrEmpty(const AValue: ShortString): Boolean; static;
+      Class Function IsNullOrWhiteSpace(const AValue: ShortString): Boolean; static;
+      Class Function Join(const Separator: ShortString; const Values: array of const): ShortString; overload; static;
+      Class Function Join(const Separator: ShortString; const Values: array of ShortString): ShortString; overload; static;
+      Class Function Join(const Separator: ShortString; const Values: array of ShortString; StartIndex: SizeInt; ACount: SizeInt): ShortString; overload; static;
+      Class Function LowerCase(const S: ShortString): ShortString; overload; static; inline;
+      Class Function Parse(const AValue: Boolean): ShortString; overload; static; inline;
+      Class Function Parse(const AValue: Extended): ShortString; overload; static;inline;
+      Class Function Parse(const AValue: Int64): ShortString; overload; static; inline;
+      Class Function Parse(const AValue: Integer): ShortString; overload; static; inline;
+      Class Function ToBoolean(const S: ShortString): Boolean; overload; static; inline;
+      Class Function ToDouble(const S: ShortString): Double; overload; static; inline;
+      Class Function ToExtended(const S: ShortString): Extended; overload; static; inline;
+      Class Function ToInt64(const S: ShortString): Int64; overload; static; inline;
+      Class Function ToInteger(const S: ShortString): Integer; overload; static; inline;
+      Class Function ToSingle(const S: ShortString): Single; overload; static; inline;
+      Class Function UpperCase(const S: ShortString): ShortString; overload; static; inline;
+      Function CompareTo(const B: ShortString): Integer;
+      Function Contains(const AValue: ShortString; IgnoreCase: Boolean = False): Boolean;
+      procedure CopyTo(SourceIndex: SizeInt; var destination: array of AnsiChar; DestinationIndex: SizeInt; ACount: SizeInt);
+      Function CountChar(const C: AnsiChar): SizeInt;
+      Function DeQuotedString: ShortString; overload;
+      Function DeQuotedString(const AQuoteChar: AnsiChar): ShortString; overload;
+      Function EndsWith(const AValue: ShortString): Boolean; overload; inline;
+      Function EndsWith(const AValue: ShortString; IgnoreCase: Boolean): Boolean; overload;
+      Function Equals(const AValue: ShortString; IgnoreCase: Boolean = False): Boolean; overload;
+      Function Format(const args: array of const): ShortString; overload;
+      Function GetHashCode: Integer;
+      Function IndexOf(AValue: AnsiChar): SizeInt; overload; inline;
+      Function IndexOf(const AValue: ShortString): SizeInt; overload; inline;
+      Function IndexOf(AValue: AnsiChar; StartIndex: SizeInt): SizeInt; overload;
+      Function IndexOf(const AValue: ShortString; StartIndex: SizeInt): SizeInt; overload;
+      Function IndexOf(AValue: AnsiChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+      Function IndexOf(const AValue: ShortString; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+      Function IndexOfUnQuoted(const AValue: ShortString; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt = 0): SizeInt; overload;
+      Function IndexOfAny(const AnyOf: array of AnsiChar): SizeInt; overload;
+      Function IndexOfAny(const AnyOf: array of AnsiChar; StartIndex: SizeInt): SizeInt; overload;
+      Function IndexOfAny(const AnyOf: array of AnsiChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+      Function IndexOfAny(const AnyOf: array of ShortString): SizeInt; overload;
+      Function IndexOfAny(const AnyOf: array of ShortString; StartIndex: SizeInt): SizeInt; overload;
+      Function IndexOfAny(const AnyOf: array of ShortString; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+      Function IndexOfAny(const AnyOf: array of ShortString; StartIndex: SizeInt; ACount: SizeInt; Out AMatch : SizeInt): SizeInt; overload;
+      Function IndexOfAnyUnquoted(const AnyOf: array of AnsiChar; StartQuote, EndQuote: AnsiChar): SizeInt; overload;
+      Function IndexOfAnyUnquoted(const AnyOf: array of AnsiChar; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt): SizeInt; overload;
+      Function IndexOfAnyUnquoted(const AnyOf: array of AnsiChar; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+      function IndexOfAnyUnquoted(const AnyOf: array of ShortString; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt; Out Matched: SizeInt): SizeInt; overload;
+      Function Insert(StartIndex: SizeInt; const AValue: ShortString): ShortString;
+      Function IsDelimiter(const Delimiters: ShortString; Index: SizeInt): Boolean;
+      Function IsEmpty: Boolean;
+      Function LastDelimiter(const Delims: ShortString): SizeInt;
+      Function LastIndexOf(AValue: AnsiChar): SizeInt; overload;
+      Function LastIndexOf(const AValue: ShortString): SizeInt; overload;
+      Function LastIndexOf(AValue: AnsiChar; AStartIndex: SizeInt): SizeInt; overload;
+      Function LastIndexOf(const AValue: ShortString; AStartIndex: SizeInt): SizeInt; overload;
+      Function LastIndexOf(AValue: AnsiChar; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+      Function LastIndexOf(const AValue: ShortString; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+      Function LastIndexOfAny(const AnyOf: array of AnsiChar): SizeInt; overload;
+      Function LastIndexOfAny(const AnyOf: array of AnsiChar; AStartIndex: SizeInt): SizeInt; overload;
+      Function LastIndexOfAny(const AnyOf: array of AnsiChar; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+      Function PadLeft(ATotalWidth: SizeInt): ShortString; overload; inline;
+      Function PadLeft(ATotalWidth: SizeInt; PaddingChar: AnsiChar): ShortString; overload; inline;
+      Function PadRight(ATotalWidth: SizeInt): ShortString; overload; inline;
+      Function PadRight(ATotalWidth: SizeInt; PaddingChar: AnsiChar): ShortString; overload; inline;
+      Function QuotedString: ShortString; overload;
+      Function QuotedString(const AQuoteChar: AnsiChar): ShortString; overload;
+      Function Remove(StartIndex: SizeInt): ShortString; overload; inline;
+      Function Remove(StartIndex: SizeInt; ACount: SizeInt): ShortString; overload; inline;
+      Function Replace(OldChar: AnsiChar; NewChar: AnsiChar): ShortString; overload;
+      Function Replace(OldChar: AnsiChar; NewChar: AnsiChar; ReplaceFlags: TReplaceFlags): ShortString; overload;
+      Function Replace(const OldValue: ShortString; const NewValue: ShortString): ShortString; overload;
+      Function Replace(const OldValue: ShortString; const NewValue: ShortString; ReplaceFlags: TReplaceFlags): ShortString; overload;
+      Function Split(const Separators: array of AnsiChar): TShortStringArray; overload;
+      Function Split(const Separators: array of AnsiChar; ACount: SizeInt): TShortStringArray; overload;
+      Function Split(const Separators: array of AnsiChar; Options: TStringSplitOptions): TShortStringArray; overload;
+      Function Split(const Separators: array of AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TShortStringArray; overload;
+      Function Split(const Separators: array of ShortString): TShortStringArray; overload;
+      Function Split(const Separators: array of ShortString; ACount: SizeInt): TShortStringArray; overload;
+      Function Split(const Separators: array of ShortString; Options: TStringSplitOptions): TShortStringArray; overload;
+      Function Split(const Separators: array of ShortString; ACount: SizeInt; Options: TStringSplitOptions): TShortStringArray; overload;
+      Function Split(const Separators: array of AnsiChar; AQuote: AnsiChar): TShortStringArray; overload;
+      Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar): TShortStringArray; overload;
+      Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar; Options: TStringSplitOptions): TShortStringArray; overload;
+      Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt): TShortStringArray; overload;
+      Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TShortStringArray; overload;
+      Function Split(const Separators: array of ShortString; AQuote: AnsiChar): TShortStringArray; overload;
+      Function Split(const Separators: array of ShortString; AQuoteStart, AQuoteEnd: AnsiChar): TShortStringArray; overload;
+      Function Split(const Separators: array of ShortString; AQuoteStart, AQuoteEnd: AnsiChar; Options: TStringSplitOptions): TShortStringArray; overload;
+      Function Split(const Separators: array of ShortString; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt): TShortStringArray; overload;
+      Function Split(const Separators: array of ShortString; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TShortStringArray; overload;
+      Function StartsWith(const AValue: ShortString): Boolean; overload; inline;
+      Function StartsWith(const AValue: ShortString; IgnoreCase: Boolean): Boolean; overload;
+      Function Substring(AStartIndex: SizeInt): ShortString; overload;
+      Function Substring(AStartIndex: SizeInt; ALen: SizeInt): ShortString; overload;
+      Function ToBoolean: Boolean; overload; inline;
+      Function ToInteger: Integer; overload; inline;
+      Function ToInt64: Int64; overload; inline;
+      Function ToSingle: Single; overload; inline;
+      Function ToDouble: Double; overload; inline;
+      Function ToExtended: Extended; overload; inline;
+      Function ToCharArray: TCharArray; overload;
+      Function ToCharArray(AStartIndex: SizeInt; ALen: SizeInt): TCharArray; overload;
+      Function ToLower: ShortString; overload; inline;
+      Function ToLowerInvariant: ShortString;
+      Function ToUpper: ShortString; overload; inline;
+      Function ToUpperInvariant: ShortString; inline;
+      Function Trim: ShortString; overload;
+      Function TrimLeft: ShortString; overload;
+      Function TrimRight: ShortString; overload;
+      Function Trim(const ATrimChars: array of AnsiChar): ShortString; overload;
+      Function TrimLeft(const ATrimChars: array of AnsiChar): ShortString; overload;
+      Function TrimRight(const ATrimChars: array of AnsiChar): ShortString; overload;
+      Function TrimEnd(const ATrimChars: array of AnsiChar): ShortString; deprecated 'Use TrimRight';
+      Function TrimStart(const ATrimChars: array of AnsiChar): ShortString; deprecated 'Use TrimLeft';
+      property Chars[AIndex: SizeInt]: AnsiChar read GetChar;
+      property Length: SizeInt read GetLength;
+    end;
+
+
+
 {$IFDEF FPC_HAS_TYPE_SINGLE}
   TSingleHelper = Type Helper for Single
   Private

+ 1494 - 0
rtl/objpas/sysutils/syshelps.inc

@@ -0,0 +1,1494 @@
+{%MainUnit sysutils.pp}
+{ ---------------------------------------------------------------------
+  TStringHelper
+  ---------------------------------------------------------------------}
+
+{$IFNDEF IS_SHORTSTRINGHELPER}
+{$IFNDEF IS_UNICODESTRINGHELPER}
+// Doubles with (wide/ansi)string...
+Function HaveChar(AChar : TStringChar; const AList: array of TStringChar) : Boolean;
+
+Var
+  I : SizeInt;
+
+begin
+  I:=0;
+  Result:=False;
+  While (Not Result) and (I<Length(AList)) do
+    begin
+    Result:=(AList[i]=AChar);
+    Inc(I);
+    end;
+end;
+{$ENDIF}
+{$ENDIF}
+
+function TStringHelper.GetChar(AIndex: SizeInt): TStringChar;
+begin
+  Result:=Self[AIndex+1];
+end;
+
+
+function TStringHelper.GetLength: SizeInt;
+
+begin
+  Result:=System.Length(Self);
+end;
+
+
+class function TStringHelper.Compare(const A: TStringType; const B: TStringType): Integer;
+begin
+  Result:=Compare(A,0,B,0,System.Length(B),[]);
+end;
+
+
+class function TStringHelper.Compare(const A: TStringType; const B: TStringType;
+  IgnoreCase: Boolean): Integer; //deprecated 'Use same with TCompareOptions';
+begin
+  if IgnoreCase then
+    Result:=Compare(A,B,[coIgnoreCase])
+  else
+    Result:=Compare(A,B,[]);
+end;
+
+
+class function TStringHelper.Compare(const A: TStringType; const B: TStringType;
+  Options: TCompareOptions): Integer;
+begin
+  Result:=Compare(A,0,B,0,System.Length(B),Options);
+end;
+
+
+class function TStringHelper.Compare(const A: TStringType; IndexA: SizeInt;
+  const B: TStringType; IndexB: SizeInt; ALen: SizeInt): Integer;
+begin
+  Result:=Compare(A,IndexA,B,IndexB,ALen,[]);
+end;
+
+
+class function TStringHelper.Compare(const A: TStringType; IndexA: SizeInt;
+  const B: TStringType; IndexB: SizeInt; ALen: SizeInt; IgnoreCase: Boolean
+  ): Integer; //deprecated 'Use same with TCompareOptions';
+begin
+  if IgnoreCase then
+    Result:=Compare(A,IndexA,B,IndexB,ALen,[coIgnoreCase])
+  else
+    Result:=Compare(A,IndexA,B,IndexB,ALen,[])
+end;
+
+
+class function TStringHelper.Compare(const A: TStringType; IndexA: SizeInt;
+  const B: TStringType; IndexB: SizeInt; ALen: SizeInt; Options: TCompareOptions
+  ): Integer;
+
+Var
+  L : SizeInt;
+
+begin
+  L:=ALen;
+  If (L>system.Length(A)-IndexA) then
+    L:=system.Length(A)-IndexA;
+  If (L>system.Length(B)-IndexB) then
+    L:=system.Length(B)-IndexB;
+  if (coIgnoreCase in Options) then
+    begin
+    Result:=strlicomp(PTStringChar(@A[IndexA+1]),PTStringChar(@B[IndexB+1]),L)
+    end
+  else
+    Result:=strlcomp(PTStringChar(@A[IndexA+1]),PTStringChar(@B[IndexB+1]),L);
+end;
+
+
+class function TStringHelper.CompareOrdinal(const A: TStringType; const B: TStringType
+  ): Integer;
+
+Var
+  L : SizeInt;
+
+begin
+  L:=System.Length(B);
+  if L>System.Length(A) then
+    L:=System.Length(A);
+  Result:=CompareOrdinal(A,0,B,0,L);
+end;
+
+
+class function TStringHelper.CompareOrdinal(const A: TStringType; IndexA: SizeInt;
+  const B: TStringType; IndexB: SizeInt; ALen: SizeInt): Integer;
+
+begin
+  Result:=StrLComp(PTStringChar(@A[IndexA+1]), PTStringChar(@B[IndexB+1]), ALen);
+end;
+
+
+class function TStringHelper.CompareText(const A: TStringType; const B: TStringType
+  ): Integer;
+begin
+  Result:=Sysutils.CompareText(A,B);
+end;
+
+
+class function TStringHelper.Copy(const Str: TStringType): TStringType;
+begin
+  Result:=Str;
+{$IFNDEF IS_SHORTSTRINGHELPER}
+  UniqueString(Result);
+{$ENDIF}
+end;
+
+
+class function TStringHelper.Create(AChar: TStringChar; ACount: SizeInt): TStringType;
+begin
+   Result:=StringOfChar(AChar,ACount);
+end;
+
+
+class function TStringHelper.Create(const AValue: array of TStringChar): TStringType;
+
+begin
+  Result:=Create(AValue,0,System.Length(AValue));
+end;
+
+
+class function TStringHelper.Create(const AValue: array of TStringChar;
+  StartIndex: SizeInt; ALen: SizeInt): TStringType;
+begin
+  SetLength(Result,ALen);
+  if ALen>0 then
+    Move(AValue[StartIndex],Result[1],ALen);
+end;
+
+
+class function TStringHelper.EndsText(const ASubText, AText: TStringType): Boolean;
+begin
+  Result:=(ASubText<>'') and (sysutils.CompareText(System.Copy(AText,System.Length(AText)-System.Length(ASubText)+1,System.Length(ASubText)),ASubText)=0);
+end;
+
+
+class function TStringHelper.Equals(const a: TStringType; const b: TStringType): Boolean;
+begin
+  Result:=A=B;
+end;
+
+
+class function TStringHelper.Format(const AFormat: TStringType;
+  const args: array of const): TStringType;
+begin
+  Result:=Sysutils.Format(AFormat,Args);
+end;
+
+
+class function TStringHelper.IsNullOrEmpty(const AValue: TStringType): Boolean;
+begin
+  Result:=system.Length(AValue)=0;
+end;
+
+
+class function TStringHelper.IsNullOrWhiteSpace(const AValue: TStringType): Boolean;
+const
+  LWhiteSpace = [#0..' '];
+var
+  I: SizeInt;
+begin
+  for I:=1 to System.Length(AValue) do
+    if not (AValue[I] in LWhiteSpace) then
+      exit(False);
+  Result:=True;
+end;
+
+
+class function TStringHelper.Join(const Separator: TStringType;
+  const Values: array of const): TStringType;
+
+Var
+  SValues : Array of TStringType;
+  I,L : SizeInt;
+  S : TStringType;
+  P : ^TVarRec;
+
+begin
+  L:=System.Length(Values);
+  SetLength(SValues,L);
+  Dec(L);
+  for I:=0 to L do
+    begin
+    S:='';
+    P:=@Values[I];
+    Case P^.VType of
+      vtInteger  : S:=IntToStr(P^.VInteger);
+      vtBoolean  : S:=BoolToStr(P^.VBoolean, True);
+      vtChar     : S:=P^.VChar;
+      vtPChar    : S:= TStringType(P^.VPChar);
+      {$ifndef FPUNONE}
+      vtExtended : S:=FloatToStr(P^.VExtended^);
+      {$endif}
+      vtObject   : S:=TObject(P^.VObject).Classname;
+      vtClass    : S:=P^.VClass.Classname;
+      vtCurrency : S:=CurrToStr(P^.VCurrency^);
+      vtVariant  : S:=(P^.VVariant^);
+      vtInt64    : S:=IntToStr(PInt64(P^.VInt64)^);
+      vtQword    : S:=IntToStr(PQWord(P^.VQword)^);
+      vtWideChar     : S:=WideString(P^.VWideChar);
+      vtPWideChar     : S:=WideString(P^.VPWideChar);
+      vtUnicodeString : S:=UnicodeString(P^.VUnicodeString);
+      vtAnsiString    : S:=Ansistring(P^.VAnsiString);
+    else
+      S:=Format('Unknown type: %d',[P^.VType]);
+    end;
+    SValues[I]:=S;
+    end;
+  Result:=Join(Separator,SValues);
+end;
+
+
+class function TStringHelper.Join(const Separator: TStringType;
+  const Values: array of TStringType): TStringType;
+begin
+  Result:=Join(Separator,Values,0,System.Length(Values));
+end;
+
+
+class function TStringHelper.Join(const Separator: TStringType;
+  const Values: array of TStringType; StartIndex: SizeInt; ACount: SizeInt): TStringType;
+Var
+  VLen,I,CountLim,NR,NSep,N : SizeInt;
+  Rp: PTStringChar;
+begin
+  VLen:=System.Length(Values);
+  If (ACount=0)  then
+    Exit('');
+  CountLim:=VLen-StartIndex;
+  if ACount>CountLim then
+    ACount:=CountLim;
+  If (ACount<0) or (StartIndex>VLen) or (StartIndex<0) then
+    raise ERangeError.Create(SRangeError);
+  if ACount=1 then
+    exit(Values[StartIndex]);
+  NSep:=System.Length(Separator);
+  NR:=(ACount-1)*NSep;
+  for I:=StartIndex to StartIndex+ACount-1 do
+    NR:=NR+System.Length(Values[I]);
+  SetLength(Result,NR);
+  Rp:=@Result[1];
+  for I:=StartIndex to StartIndex+ACount-1 do
+     begin
+        if I>StartIndex then
+          begin
+            Move(separator[1],Rp^,NSep*sizeof(TStringChar));
+            Rp:=Rp+NSep;
+          end;
+        N:=System.Length(Values[I]);
+        Move(Values[I][1],Rp^,N*sizeof(TStringChar));
+        Rp:=Rp+N;
+     end;
+end;
+
+
+class function TStringHelper.LowerCase(const S: TStringType): TStringType;
+begin
+  Result:=sysutils.Lowercase(S);
+end;
+
+
+class function TStringHelper.Parse(const AValue: Boolean): TStringType;
+begin
+  Result:=BoolToStr(AValue);
+end;
+
+
+class function TStringHelper.Parse(const AValue: Extended): TStringType;
+begin
+  Result:=FloatToStr(AValue);
+end;
+
+
+class function TStringHelper.Parse(const AValue: Int64): TStringType;
+begin
+  Result:=IntToStr(AValue);
+end;
+
+
+class function TStringHelper.Parse(const AValue: Integer): TStringType;
+begin
+  Result:=IntToStr(AValue);
+end;
+
+
+class function TStringHelper.ToBoolean(const S: TStringType): Boolean;
+begin
+  Result:=StrToBool(S);
+end;
+
+
+class function TStringHelper.ToDouble(const S: TStringType): Double;
+begin
+  Result:=StrToFloat(S);
+end;
+
+
+class function TStringHelper.ToExtended(const S: TStringType): Extended;
+begin
+  Result:=StrToFloat(S);
+end;
+
+
+class function TStringHelper.ToInt64(const S: TStringType): Int64;
+begin
+  Result:=StrToInt64(S);
+end;
+
+
+class function TStringHelper.ToInteger(const S: TStringType): Integer;
+begin
+  Result:=StrToInt(S);
+end;
+
+
+class function TStringHelper.ToSingle(const S: TStringType): Single;
+begin
+  Result:=StrToFloat(S);
+end;
+
+
+class function TStringHelper.UpperCase(const S: TStringType): TStringType;
+begin
+  Result:=sysutils.Uppercase(S);
+end;
+
+
+function TStringHelper.CompareTo(const B: TStringType): Integer;
+begin
+  // Order is important
+{$IFDEF IS_SHORTSTRINGHELPER}
+  Result:=sysUtils.StrComp(PTStringChar(@Self[1]),PTStringChar(@B[1]));
+{$ELSE}
+  Result:=sysUtils.StrComp(PTStringChar(Self),PTStringChar(B));
+{$ENDIF}
+end;
+
+procedure TStringHelper.CopyTo(SourceIndex: SizeInt; var destination: array of TStringChar; DestinationIndex: SizeInt; ACount: SizeInt);
+
+Var
+  P1,P2 : PTStringChar;
+begin
+//  Writeln('((',DestinationIndex,'+',ACount,')<',System.Length(Destination),')  : ', ((DestinationIndex+ACount)<System.Length(Destination)));
+  if ((DestinationIndex+ACount)<=System.Length(Destination)) then
+    begin
+//    Writeln('AHA');
+    P1:=@Self[SourceIndex+1];
+    P2:=@Destination[DestinationIndex];
+    Move(P1^,P2^,ACount*SizeOf(TStringChar));
+    end;
+end;
+
+function TStringHelper.Contains(const AValue: TStringType; IgnoreCase: Boolean): Boolean;
+begin
+  if IgnoreCase then
+    Result:=Pos(LowerCase(AValue),LowerCase(Self))>0
+  else
+    Result:=Pos(AValue,Self)>0;
+end;
+
+
+function TStringHelper.CountChar(const C: TStringChar): SizeInt;
+
+Var
+  S : TStringChar;
+begin
+  Result:=0;
+  For S in Self do
+    if (S=C) then
+      Inc(Result);
+end;
+
+
+function TStringHelper.DeQuotedString: TStringType;
+begin
+  Result:=DeQuotedString('''');
+end;
+
+
+function TStringHelper.DeQuotedString(const AQuoteChar: TStringChar): TStringType;
+
+var
+  L,I : SizeInt;
+  Res : Array of TStringChar;
+  PS,PD : PTStringChar;
+  IsQuote : Boolean;
+
+begin
+  L:=System.Length(Self);
+  if (L<2) or Not ((Self[1]=AQuoteChar) and (Self[L]=AQuoteChar)) then
+    Exit(Self);
+  SetLength(Res,L);
+  IsQuote:=False;
+  PS:=@Self[2];
+  PD:=@Res[0];
+  For I:=2 to L-1 do
+    begin
+    if (PS^=AQuoteChar) then
+      begin
+      IsQuote:=Not IsQuote;
+      if Not IsQuote then
+        begin
+        PD^:=PS^;
+        Inc(PD);
+        end;
+      end
+    else
+      begin
+      if IsQuote then
+        IsQuote:=false;
+      PD^:=PS^;
+      Inc(PD);
+      end;
+    Inc(PS);
+    end;
+  SetString(Result,@Res[0],PD-@Res[0]);
+end;
+
+
+function TStringHelper.EndsWith(const AValue: TStringType): Boolean;
+begin
+  Result:=EndsWith(AValue,False);
+end;
+
+
+function TStringHelper.EndsWith(const AValue: TStringType; IgnoreCase: Boolean): Boolean;
+
+Var
+  L,NS : SizeInt;
+
+begin
+  L:=system.Length(AVAlue);
+  NS:=System.Length(Self);
+  Result:=L<=NS;
+  if Result then
+    if IgnoreCase then
+      Result:=SameText(System.Copy(Self,NS-L+1,L),AValue)
+    else
+{$IFDEF IS_SHORTSTRINGHELPER}
+      Result:=CompareChar(PTStringChar(@Self[1])[NS-L],PTStringChar(@AValue[1])^,L)=0;
+{$ELSE}
+      Result:=CompareChar(PTStringChar(Pointer(Self))[NS-L],PTStringChar(Pointer(AValue))^,L)=0;
+{$ENDIF}
+end;
+
+
+function TStringHelper.Equals(const AValue: TStringType; IgnoreCase: Boolean = False): Boolean;
+
+begin
+  if IgnoreCase then
+    Result:=SameText(Self,aValue)
+  else
+    Result:=(Self=AValue);
+end;
+
+
+function TStringHelper.Format(const args: array of const): TStringType;
+
+begin
+  Result:=Format(Self,Args);
+end;
+
+
+function TStringHelper.GetHashCode: Integer;
+
+// Taken from contnrs, fphash
+var
+  P,pmax : PTStringChar;
+begin
+{$push}
+{$Q-}
+  Result:=0;
+  {$IFDEF IS_SHORTSTRINGHELPER}
+  P:=PTStringChar(@Self[1]);
+  {$ELSE}
+  P:=PTStringChar(Self);
+  {$ENDIF}
+  pmax:=p+length;
+  while (p<pmax) do
+    begin
+    Result:=LongWord(LongInt(Result shl 5) - LongInt(Result)) xor LongWord(P^);
+    Inc(p);
+    end;
+{$pop}
+end;
+
+
+function TStringHelper.IndexOf(AValue: TStringChar): SizeInt;
+begin
+  Result:=IndexOf(AValue,0,Length);
+end;
+
+
+function TStringHelper.IndexOf(const AValue: TStringType): SizeInt;
+begin
+  Result:=IndexOf(AValue,0,Length);
+end;
+
+
+function TStringHelper.IndexOf(AValue: TStringChar; StartIndex: SizeInt): SizeInt;
+begin
+  Result:=IndexOf(AValue,StartIndex,Length);
+end;
+
+
+function TStringHelper.IndexOf(const AValue: TStringType; StartIndex: SizeInt
+  ): SizeInt;
+begin
+  Result:=IndexOf(AValue,StartIndex,Length);
+end;
+
+
+function TStringHelper.IndexOf(AValue: TStringChar; StartIndex: SizeInt;
+  ACount: SizeInt): SizeInt;
+
+Var
+  CountLim : SizeInt;
+
+begin
+  if StartIndex<0 then
+    StartIndex:=0;
+  CountLim:=System.Length(Self)-StartIndex;
+  if ACount>CountLim then
+    ACount:=CountLim;
+  if ACount<=0 then
+    Exit(-1);
+  // pointer casts are to access self as 0 based index!
+  {$IFDEF IS_SHORTSTRINGHELPER}
+  Result:=IndexChar(PTStringChar(@self[1])[StartIndex],ACount,AValue);
+  {$ELSE}
+  Result:=IndexChar(PTStringChar(Pointer(self))[StartIndex],ACount,AValue);
+  {$ENDIF}
+  if Result>=0 then
+    Result:=Result+StartIndex;
+end;
+
+
+function TStringHelper.IndexOf(const AValue: TStringType; StartIndex: SizeInt;
+  ACount: SizeInt): SizeInt;
+
+Var
+  CountLim,NV,Ofs : SizeInt;
+  SP,SE : PTStringChar;
+
+begin
+  if StartIndex<0 then
+    StartIndex:=0;
+  CountLim:=System.Length(Self)-StartIndex;
+  if ACount>CountLim then
+    ACount:=CountLim;
+  NV:=System.Length(AValue);
+  if (NV>0) and (ACount>=NV) then
+    begin
+{$IFDEF IS_SHORTSTRINGHELPER}
+      SP:=PTStringChar(@Self[1])+StartIndex;
+{$ELSE}
+      SP:=PTStringChar(Pointer(Self))+StartIndex;
+{$ENDIF}
+      SE:=SP+ACount-NV+1;
+      repeat
+        {$IFDEF IS_SHORTSTRINGHELPER}
+        Ofs:=IndexChar(SP^,SE-SP,PTStringChar(@AValue[1])[0]);
+        {$ELSE}
+        Ofs:=IndexChar(SP^,SE-SP,PTStringChar(Pointer(AValue))[0]);
+        {$ENDIF}
+        if Ofs<0 then
+          Break;
+        SP:=SP+Ofs+1;
+        {$IFDEF IS_SHORTSTRINGHELPER}
+        if CompareChar(SP^,PTStringChar(@AValue[1])[1],NV-1)=0 then
+          Exit(SP-PTStringChar(@Self[1])-1);
+        {$ELSE}
+        if CompareChar(SP^,PTStringChar(Pointer(AValue))[1],NV-1)=0 then
+          Exit(SP-PTStringChar(Pointer(Self))-1);
+        {$ENDIF}
+      until false;
+    end;
+  Result:=-1;
+end;
+
+function TStringHelper.IndexOfUnQuoted(const AValue: TStringType; StartQuote,
+  EndQuote: TStringChar; StartIndex: SizeInt = 0): SizeInt;
+
+Var
+  LV : SizeInt;
+
+  Function MatchAt(I : SizeInt) : Boolean ; Inline;
+
+  Var
+    J : SizeInt;
+
+  begin
+    J:=1;
+    Repeat
+      Result:=(Self[I+J-1]=AValue[j]);
+      Inc(J);
+    Until (Not Result) or (J>LV);
+  end;
+
+Var
+  I,L,Q: SizeInt;
+
+begin
+  Result:=-1;
+  LV:=system.Length(AValue);
+  L:=Length-LV+1;
+  if L<0 then
+    L:=0;
+  I:=StartIndex+1;
+  Q:=0;
+  if StartQuote=EndQuote then
+    begin
+    While (Result=-1) and (I<=L) do
+      begin
+      if (Self[I]=StartQuote) then
+        Q:=1-Q;
+      if (Q=0) and MatchAt(i) then
+        Result:=I-1;
+      Inc(I);
+      end;
+    end
+  else
+    begin
+    While (Result=-1) and (I<=L) do
+      begin
+      if Self[I]=StartQuote then
+        Inc(Q)
+      else if (Self[I]=EndQuote) and (Q>0) then
+        Dec(Q);
+      if (Q=0) and MatchAt(i) then
+        Result:=I-1;
+      Inc(I);
+      end;
+    end;
+end;
+
+
+function TStringHelper.IndexOfAny(const AnyOf: array of TStringChar): SizeInt;
+begin
+  Result:=IndexOfAny(AnyOf,0,Length);
+end;
+
+
+function TStringHelper.IndexOfAny(const AnyOf: array of TStringChar;
+  StartIndex: SizeInt): SizeInt;
+begin
+  Result:=IndexOfAny(AnyOf,StartIndex,Length);
+end;
+
+
+function TStringHelper.IndexOfAny(const AnyOf: array of TStringChar;
+  StartIndex: SizeInt; ACount: SizeInt): SizeInt;
+
+Var
+  i,L : SizeInt;
+
+begin
+  I:=StartIndex+1;
+  L:=I+ACount-1;
+  If L>Length then
+    L:=Length;
+  Result:=-1;
+  While (Result=-1) and (I<=L) do
+    begin
+    if HaveChar(Self[i],AnyOf) then
+      Result:=I-1;
+    Inc(I);
+    end;
+end;
+
+function TStringHelper.IndexOfAny(const AnyOf: array of TStringType): SizeInt;
+begin
+  Result:=IndexOfAny(AnyOf,0,Length);
+end;
+
+function TStringHelper.IndexOfAny(const AnyOf: array of TStringType;
+  StartIndex: SizeInt): SizeInt;
+begin
+  Result:=IndexOfAny(AnyOf,StartIndex,Length-StartIndex);
+end;
+
+function TStringHelper.IndexOfAny(const AnyOf: array of TStringType;
+  StartIndex: SizeInt; ACount: SizeInt): SizeInt;
+
+Var
+  M : SizeInt;
+
+begin
+  Result:=IndexOfAny(AnyOf,StartIndex,ACount,M);
+end;
+
+function TStringHelper.IndexOfAny(const AnyOf: array of TStringType;
+  StartIndex: SizeInt; ACount: SizeInt; out AMatch: SizeInt): SizeInt;
+
+Var
+  L,I : SizeInt;
+
+begin
+  Result:=-1;
+  For I:=0 to System.Length(AnyOf)-1 do
+    begin
+    L:=IndexOf(AnyOf[i],StartIndex,ACount);
+    If (L>=0) and ((Result=-1) or (L<Result)) then
+      begin
+      Result:=L;
+      AMatch:=I;
+      end;
+    end;
+end;
+
+
+function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of TStringChar;
+  StartQuote, EndQuote: TStringChar): SizeInt;
+begin
+  Result:=IndexOfAnyUnquoted(AnyOf,StartQuote,EndQuote,0,Length);
+end;
+
+
+function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of TStringChar;
+  StartQuote, EndQuote: TStringChar; StartIndex: SizeInt): SizeInt;
+begin
+  Result:=IndexOfAnyUnquoted(AnyOf,StartQuote,EndQuote,StartIndex,Length);
+end;
+
+
+function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of TStringChar;
+  StartQuote, EndQuote: TStringChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt;
+
+Var
+  I,L : SizeInt;
+  Q : SizeInt;
+
+begin
+  Result:=-1;
+  L:=StartIndex+ACount-1;
+  if L>Length then
+    L:=Length;
+  I:=StartIndex+1;
+  Q:=0;
+  if StartQuote=EndQuote then
+    begin
+    While (Result=-1) and (I<=L) do
+      begin
+      if (Self[I]=StartQuote) then
+        Q:=1-Q;
+      if (Q=0) and HaveChar(Self[i],AnyOf) then
+        Result:=I-1;
+      Inc(I);
+      end;
+    end
+  else
+  begin
+    While (Result=-1) and (I<=L) do
+      begin
+      if Self[I]=StartQuote then
+        Inc(Q)
+      else if (Self[I]=EndQuote) and (Q>0) then
+        Dec(Q);
+      if (Q=0) and HaveChar(Self[i],AnyOf) then
+        Result:=I-1;
+      Inc(I);
+      end;
+    end;
+
+end;
+
+function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of TStringType;
+  StartQuote, EndQuote: TStringChar; StartIndex: SizeInt; out Matched: SizeInt
+  ): SizeInt;
+
+Var
+  L,I : SizeInt;
+
+begin
+  Result:=-1;
+  For I:=0 to System.Length(AnyOf)-1 do
+    begin
+    L:=IndexOfUnquoted(AnyOf[i],StartQuote,EndQuote,StartIndex);
+    If (L>=0) and ((Result=-1) or (L<Result)) then
+      begin
+      Result:=L;
+      Matched:=I;
+      end;
+    end;
+end;
+
+
+function TStringHelper.Insert(StartIndex: SizeInt; const AValue: TStringType
+  ): TStringType;
+begin
+  system.Insert(AValue,Self,StartIndex+1);
+  Result:=Self;
+end;
+
+
+function TStringHelper.IsDelimiter(const Delimiters: TStringType; Index: SizeInt
+  ): Boolean;
+begin
+  Result:=sysutils.IsDelimiter(Delimiters,Self,Index+1);
+end;
+
+
+function TStringHelper.IsEmpty: Boolean;
+begin
+  Result:=(Length=0)
+end;
+
+
+function TStringHelper.LastDelimiter(const Delims: TStringType): SizeInt;
+begin
+  Result:=sysutils.LastDelimiter(Delims,Self)-1;
+end;
+
+
+function TStringHelper.LastIndexOf(AValue: TStringChar): SizeInt;
+begin
+  Result:=LastIndexOf(AValue,Length-1,Length);
+end;
+
+
+function TStringHelper.LastIndexOf(const AValue: TStringType): SizeInt;
+begin
+  Result:=LastIndexOf(AValue,Length-1,Length);
+end;
+
+
+function TStringHelper.LastIndexOf(AValue: TStringChar; AStartIndex: SizeInt): SizeInt;
+begin
+  Result:=LastIndexOf(AValue,AStartIndex,Length);
+end;
+
+
+function TStringHelper.LastIndexOf(const AValue: TStringType; AStartIndex: SizeInt
+  ): SizeInt;
+begin
+  Result:=LastIndexOf(AValue,AStartIndex,Length);
+end;
+
+
+function TStringHelper.LastIndexOf(AValue: TStringChar; AStartIndex: SizeInt;
+  ACount: SizeInt): SizeInt;
+
+Var
+  Min : SizeInt;
+
+begin
+  Result:=AStartIndex+1;
+  Min:=Result-ACount+1;
+  If Min<1 then
+    Min:=1;
+  While (Result>=Min) and (Self[Result]<>AValue) do
+    Dec(Result);
+  if Result<Min then
+    Result:=-1
+  else
+    Result:=Result-1;
+end;
+
+
+function TStringHelper.LastIndexOf(const AValue: TStringType; AStartIndex: SizeInt; ACount: SizeInt): SizeInt;
+  
+var
+  I,L,LS,M : SizeInt;
+  S : TStringType;
+  P : PTStringChar;
+    
+begin
+  Result:=-1;
+  LS:=system.Length(Self);
+  L:=system.Length(AValue);
+  if (L=0) or (L>LS) then
+    Exit;
+{$IFDEF IS_SHORTSTRINGHELPER}
+  P:=PTStringChar(@AValue[1]);
+{$ELSE}
+  P:=PTStringChar(AValue);
+{$ENDIF}
+  S:=Self;
+  I:=AStartIndex+1; // 1 based
+  if (I>LS) then
+    I:=LS;
+  I:=I-L+1;
+  M:=AStartIndex-ACount+2; // 1 based
+  if M<1 then
+    M:=1;
+  while (Result=-1) and (I>=M) do
+    begin
+    if (0=StrLComp(PTStringChar(@S[I]),P,L)) then
+      Result:=I-1;
+    Dec(I);
+    end;
+end;
+
+
+function TStringHelper.LastIndexOfAny(const AnyOf: array of TStringChar): SizeInt;
+begin
+  Result:=LastIndexOfAny(AnyOf,Length-1,Length);
+end;
+
+
+function TStringHelper.LastIndexOfAny(const AnyOf: array of TStringChar;
+  AStartIndex: SizeInt): SizeInt;
+begin
+  Result:=LastIndexOfAny(AnyOf,AStartIndex,Length);
+end;
+
+
+function TStringHelper.LastIndexOfAny(const AnyOf: array of TStringChar;
+  AStartIndex: SizeInt; ACount: SizeInt): SizeInt;
+
+Var
+  Min : SizeInt;
+
+begin
+  Result:=AStartIndex+1;
+  Min:=Result-ACount+1;
+  If Min<1 then
+    Min:=1;
+  While (Result>=Min) and Not HaveChar(Self[Result],AnyOf) do
+    Dec(Result);
+  if Result<Min then
+    Result:=-1
+  else
+    Result:=Result-1;
+end;
+
+
+function TStringHelper.PadLeft(ATotalWidth: SizeInt): TStringType;
+begin
+  Result:=PadLeft(ATotalWidth,' ');
+end;
+
+
+function TStringHelper.PadLeft(ATotalWidth: SizeInt; PaddingChar: TStringChar): TStringType;
+Var
+  L : SizeInt;
+
+begin
+  Result:=Self;
+  L:=ATotalWidth-Length;
+  If L>0 then
+    Result:=StringOfChar(PaddingChar,L)+Result;
+end;
+
+
+function TStringHelper.PadRight(ATotalWidth: SizeInt): TStringType;
+begin
+  Result:=PadRight(ATotalWidth,' ');
+end;
+
+
+function TStringHelper.PadRight(ATotalWidth: SizeInt; PaddingChar: TStringChar
+  ): TStringType;
+
+Var
+  L : SizeInt;
+
+begin
+  Result:=Self;
+  L:=ATotalWidth-Length;
+  If L>0 then
+    Result:=Result+StringOfChar(PaddingChar,L);
+end;
+
+
+function TStringHelper.QuotedString: TStringType;
+begin
+  Result:=QuotedStr(Self);
+end;
+
+
+function TStringHelper.QuotedString(const AQuoteChar: TStringChar): TStringType;
+begin
+  Result:=AnsiQuotedStr(Self,AQuoteChar);
+end;
+
+
+function TStringHelper.Remove(StartIndex: SizeInt): TStringType;
+begin
+  Result:=Remove(StartIndex,Self.Length-StartIndex);
+end;
+
+
+function TStringHelper.Remove(StartIndex: SizeInt; ACount: SizeInt): TStringType;
+begin
+  Result:=Self;
+  System.Delete(Result,StartIndex+1,ACount);
+end;
+
+
+function TStringHelper.Replace(OldChar: TStringChar; NewChar: TStringChar): TStringType;
+begin
+  Result:=Replace(OldChar,NewChar,[rfReplaceAll]);
+end;
+
+
+function TStringHelper.Replace(OldChar: TStringChar; NewChar: TStringChar;
+  ReplaceFlags: TReplaceFlags): TStringType;
+var
+  Sp,Se,Rp : PTStringChar;
+  Ofs : SizeInt;
+begin
+  if rfIgnoreCase in ReplaceFlags then
+    exit(StringReplace(Self,OldChar,NewChar,ReplaceFlags));
+{$IFDEF IS_SHORTSTRINGHELPER}
+  Sp:=PTStringChar(@Self[1]);
+{$ELSE}
+  Sp:=PTStringChar(Pointer(Self));
+{$ENDIF}
+  Se:=Sp+System.Length(Self);
+  Ofs:=IndexChar(Sp^,Se-Sp,OldChar);
+  if Ofs<0 then
+    exit(Self);
+  SetLength(Result,Se-Sp);
+{$IFDEF IS_SHORTSTRINGHELPER}
+  Rp:=PTStringChar(@Result[1]);
+{$ELSE}
+  Rp:=PTStringChar(Pointer(Result));
+{$ENDIF}
+  repeat
+    Move(Sp^,Rp^,Ofs*sizeof(TStringChar));
+    Sp:=Sp+Ofs+1;
+    Rp[Ofs]:=NewChar;
+    Rp:=Rp+Ofs+1;
+    if not (rfReplaceAll in ReplaceFlags) then
+      break;
+    { This loop can be removed entirely, but greatly speeds up replacing streaks of characters. }
+    while (Sp<Se) and (Sp^=OldChar) do
+      begin
+        Rp^:=NewChar;
+        Sp:=Sp+1;
+        Rp:=Rp+1;
+      end;
+    Ofs:=IndexChar(Sp^,Se-Sp,OldChar);
+  until Ofs<0;
+  Move(Sp^,Rp^,(Se-Sp)*sizeof(TStringChar));
+end;
+
+
+function TStringHelper.Replace(const OldValue: TStringType; const NewValue: TStringType
+  ): TStringType;
+begin
+  Result:=Replace(OldValue,NewValue,[rfReplaceAll]);
+end;
+
+
+function TStringHelper.Replace(const OldValue: TStringType; const NewValue: TStringType;
+  ReplaceFlags: TReplaceFlags): TStringType;
+begin
+  Result:=StringReplace(Self,OldValue,NewValue,ReplaceFlags);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringChar): TSHStringArray;
+begin
+  Result:=Split(Separators,#0,#0,Length+1,TStringSplitOptions.None);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringChar; ACount: SizeInt
+  ): TSHStringArray;
+begin
+  Result:=Split(Separators,#0,#0,ACount,TStringSplitOptions.None);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringChar;
+  Options: TStringSplitOptions): TSHStringArray;
+begin
+  Result:=Split(Separators,Length+1,Options);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringChar; ACount: SizeInt;
+  Options: TStringSplitOptions): TSHStringArray;
+begin
+  Result:=Split(Separators,#0,#0,ACount,Options);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringType): TSHStringArray;
+begin
+  Result:=Split(Separators,Length+1);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringType; ACount: SizeInt
+  ): TSHStringArray;
+begin
+  Result:=Split(Separators,ACount,TStringSplitOptions.None);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringType;
+  Options: TStringSplitOptions): TSHStringArray;
+begin
+  Result:=Split(Separators,Length+1,Options);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringType;
+  ACount: SizeInt; Options: TStringSplitOptions): TSHStringArray;
+begin
+  Result:=Split(Separators,#0,#0,ACount,Options);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringChar; AQuote: TStringChar
+  ): TSHStringArray;
+begin
+  Result:=Split(Separators,AQuote,AQuote);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringChar; AQuoteStart,
+  AQuoteEnd: TStringChar): TSHStringArray;
+begin
+  Result:=Split(Separators,AQuoteStart,AQuoteEnd,TStringSplitOptions.None);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringChar; AQuoteStart,
+  AQuoteEnd: TStringChar; Options: TStringSplitOptions): TSHStringArray;
+begin
+  Result:=Split(Separators,AQuoteStart,AQuoteEnd,Length+1,Options);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringChar; AQuoteStart,
+  AQuoteEnd: TStringChar; ACount: SizeInt): TSHStringArray;
+begin
+  Result:=Split(Separators,AQuoteStart,AQuoteEnd,ACount,TStringSplitOptions.None);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringChar; AQuoteStart,
+  AQuoteEnd: TStringChar; ACount: SizeInt; Options: TStringSplitOptions): TSHStringArray;
+
+  Function NextSep(StartIndex : SizeInt) : SizeInt;
+
+  begin
+    if (AQuoteStart<>#0) then
+      Result:=Self.IndexOfAnyUnQuoted(Separators,AQuoteStart,AQuoteEnd,StartIndex)
+    else
+      Result:=Self.IndexOfAny(Separators,StartIndex);
+  end;
+
+  Procedure MaybeGrow(Curlen : SizeInt);
+
+  begin
+    if System.Length(Result)<=CurLen then
+      SetLength(Result,System.Length(Result)+4+SizeInt(SizeUint(System.Length(Result)) div 4));
+  end;
+
+Var
+  Sep,LastSep,Len : SizeInt;
+
+begin
+  Result:=nil;
+  Len:=0;
+  LastSep:=0;
+  While ((ACount=0) or (Len<ACount)) and (LastSep<=System.Length(Self)) do
+    begin
+    Sep:=NextSep(LastSep);
+    if Sep<0 then
+      Sep:=System.Length(Self);
+//    Writeln('Examining >',T,'< at pos ',LastSep,', till pos ',Sep);
+    If (Sep>LastSep) or (not (TStringSplitOptions.ExcludeEmpty=Options)) then
+      begin
+      MaybeGrow(Len);
+      Result[Len]:=SubString(LastSep,Sep-LastSep);
+      Inc(Len);
+      end;
+    LastSep:=Sep+1;
+    end;
+
+  if (TStringSplitOptions.ExcludeLastEmpty=Options) then
+    if (Len > 0) and (Result[Len-1] = '') then
+      dec(Len);
+
+  SetLength(Result,Len);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringType; AQuote: TStringChar
+  ): TSHStringArray;
+begin
+  Result:=SPlit(Separators,AQuote,AQuote);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringType; AQuoteStart,
+  AQuoteEnd: TStringChar): TSHStringArray;
+begin
+  Result:=SPlit(Separators,AQuoteStart,AQuoteEnd,Length+1,TStringSplitOptions.None);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringType; AQuoteStart,
+  AQuoteEnd: TStringChar; Options: TStringSplitOptions): TSHStringArray;
+begin
+  Result:=SPlit(Separators,AQuoteStart,AQuoteEnd,Length+1,Options);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringType; AQuoteStart,
+  AQuoteEnd: TStringChar; ACount: SizeInt): TSHStringArray;
+begin
+  Result:=SPlit(Separators,AQuoteStart,AQuoteEnd,ACount,TStringSplitOptions.None);
+end;
+
+
+function TStringHelper.Split(const Separators: array of TStringType; AQuoteStart,
+  AQuoteEnd: TStringChar; ACount: SizeInt; Options: TStringSplitOptions): TSHStringArray;
+Const
+  BlockSize = 10;
+
+  Function NextSep(StartIndex : SizeInt; out Match : SizeInt) : SizeInt;
+
+  begin
+    if (AQuoteStart<>#0) then
+      Result:=Self.IndexOfAnyUnQuoted(Separators,AQuoteStart,AQuoteEnd,StartIndex,Match)
+    else
+      Result:=Self.IndexOfAny(Separators,StartIndex,Length,Match);
+    if Result<>-1 then
+  end;
+
+  Procedure MaybeGrow(Curlen : SizeInt);
+
+  begin
+    if System.Length(Result)<=CurLen then
+      SetLength(Result,System.Length(Result)+BlockSize);
+  end;
+
+Var
+  Sep,LastSep,Len,Match : SizeInt;
+  T : TStringType;
+
+begin
+  SetLength(Result,BlockSize);
+  Len:=0;
+  LastSep:=0;
+  Sep:=NextSep(0,Match);
+  While (Sep<>-1) and ((ACount=0) or (Len<ACount)) do
+    begin
+    T:=SubString(LastSep,Sep-LastSep);
+    If (T<>'') or (not (TStringSplitOptions.ExcludeEmpty=Options)) then
+      begin
+      MaybeGrow(Len);
+      Result[Len]:=T;
+      Inc(Len);
+      end;
+    LastSep:=Sep+System.Length(Separators[Match]);
+    Sep:=NextSep(LastSep,Match);
+    end;
+  if (LastSep<=Length) and ((ACount=0) or (Len<ACount)) then
+    begin
+    T:=SubString(LastSep);
+//    Writeln('Examining >',T,'< at pos,',LastSep,' till pos ',Sep);
+    If (T<>'') or (not (TStringSplitOptions.ExcludeEmpty=Options)) then
+      begin
+      MaybeGrow(Len);
+      Result[Len]:=T;
+      Inc(Len);
+      end;
+    end;
+
+  If (TStringSplitOptions.ExcludeLastEmpty=Options) then
+    if (Len > 0) and (Result[Len-1] = '') then
+      dec(Len);
+
+  SetLength(Result,Len);
+end;
+
+
+function TStringHelper.StartsWith(const AValue: TStringType): Boolean;
+begin
+  Result:=StartsWith(AValue,False);
+end;
+
+
+function TStringHelper.StartsWith(const AValue: TStringType; IgnoreCase: Boolean
+  ): Boolean;
+Var
+  L : SizeInt;
+
+begin
+  L:=System.Length(AValue);
+  Result:=L<=System.Length(Self);
+  if Result then
+    if IgnoreCase then
+      Result:=SameText(System.Copy(Self,1,L),AValue)
+    else
+{$IFDEF IS_SHORTSTRINGHELPER}
+      Result:=CompareChar(PTStringChar(@Self[1])^,PTStringChar(@AValue[1])^,L)=0;
+{$ELSE}
+      Result:=CompareChar(PTStringChar(Pointer(Self))^,PTStringChar(Pointer(AValue))^,L)=0;
+{$ENDIF}
+end;
+
+
+function TStringHelper.Substring(AStartIndex: SizeInt): TStringType;
+begin
+  Result:=Self.SubString(AStartIndex,Self.Length-AStartIndex);
+end;
+
+
+function TStringHelper.Substring(AStartIndex: SizeInt; ALen: SizeInt): TStringType;
+begin
+  Result:=system.Copy(Self,AStartIndex+1,ALen);
+end;
+
+
+function TStringHelper.ToBoolean: Boolean;
+begin
+  Result:=StrToBool(Self);
+end;
+
+
+function TStringHelper.ToInteger: Integer;
+begin
+  Result:=StrToInt(Self);
+end;
+
+
+function TStringHelper.ToInt64: Int64;
+begin
+  Result:=StrToInt64(Self);
+end;
+
+
+function TStringHelper.ToSingle: Single;
+begin
+  Result:=StrToFLoat(Self);
+end;
+
+
+function TStringHelper.ToDouble: Double;
+begin
+  Result:=StrToFLoat(Self);
+end;
+
+
+function TStringHelper.ToExtended: Extended;
+begin
+  Result:=StrToFLoat(Self);
+end;
+
+
+function TStringHelper.ToCharArray: TCharArray;
+
+begin
+  Result:=ToCharArray(0,Self.Length);
+end;
+
+
+function TStringHelper.ToCharArray(AStartIndex: SizeInt; ALen: SizeInt
+  ): TCharArray;
+
+Var
+  I : SizeInt;
+
+begin
+  SetLength(Result,ALen);
+  For I:=0 to ALen-1 do
+    Result[I]:=Self[AStartIndex+I+1];
+end;
+
+
+function TStringHelper.ToLower: TStringType;
+begin
+  Result:=LowerCase(Self);
+end;
+
+
+function TStringHelper.ToLowerInvariant: TStringType;
+begin
+  Result:=LowerCase(Self);
+end;
+
+
+function TStringHelper.ToUpper: TStringType;
+begin
+  Result:=UpperCase(Self);
+end;
+
+
+function TStringHelper.ToUpperInvariant: TStringType;
+begin
+  Result:=UpperCase(Self);
+end;
+
+
+function TStringHelper.Trim: TStringType;
+begin
+  Result:=SysUtils.Trim(Self);
+end;
+
+
+function TStringHelper.TrimLeft: TStringType;
+begin
+  Result:=SysUtils.TrimLeft(Self);
+end;
+
+
+function TStringHelper.TrimRight: TStringType;
+begin
+  Result:=SysUtils.TrimRight(Self);
+end;
+
+
+function TStringHelper.Trim(const ATrimChars: array of TStringChar): TStringType;
+begin
+  Result:=Self.TrimLeft(ATrimChars).TrimRight(ATrimChars);
+end;
+
+
+function TStringHelper.TrimLeft(const ATrimChars: array of TStringChar): TStringType;
+
+Var
+  I,Len : SizeInt;
+
+begin
+  I:=1;
+  Len:=Self.Length;
+  While (I<=Len) and HaveChar(Self[i],ATrimChars) do Inc(I);
+  if I=1 then
+    Result:=Self
+  else if I>Len then
+    Result:=''
+  else
+    Result:=system.Copy(Self,I,Len-I+1);
+end;
+
+
+function TStringHelper.TrimRight(const ATrimChars: array of TStringChar): TStringType;
+
+Var
+  I,Len : SizeInt;
+
+begin
+  Len:=Self.Length;
+  I:=Len;
+  While (I>=1) and HaveChar(Self[i],ATrimChars) do Dec(I);
+  if I<1 then
+    Result:=''
+  else if I=Len then
+    Result:=Self
+  else
+    Result:=system.Copy(Self,1,I);
+end;
+
+
+function TStringHelper.TrimEnd(const ATrimChars: array of TStringChar): TStringType;
+begin
+  Result:=TrimRight(ATrimChars);
+end;
+
+
+function TStringHelper.TrimStart(const ATrimChars: array of TStringChar): TStringType;
+begin
+  Result:=TrimLeft(ATrimChars);
+end;