|
@@ -76,48 +76,49 @@ begin
|
|
|
Dest := Dest + S;
|
|
|
end ;
|
|
|
|
|
|
-{ UpperCase returns a copy of S where all lowercase characters ( from a to z )
|
|
|
- have been converted to uppercase }
|
|
|
-
|
|
|
+Function InternalChangeCase(Const S : AnsiString; const Chars: TSysCharSet; const Adjustment: Longint): AnsiString;
|
|
|
+ var
|
|
|
+ i : Integer;
|
|
|
+ P : PChar;
|
|
|
+ Unique : Boolean;
|
|
|
+ begin
|
|
|
+ Result := S;
|
|
|
+ if Result='' then
|
|
|
+ exit;
|
|
|
+ Unique:=false;
|
|
|
+ P:=PChar(Result);
|
|
|
+ for i:=1 to Length(Result) do
|
|
|
+ begin
|
|
|
+ if CharInSet(P^,Chars) then
|
|
|
+ begin
|
|
|
+ if not Unique then
|
|
|
+ begin
|
|
|
+ UniqueString(Result);
|
|
|
+ p:=@Result[i];
|
|
|
+ Unique:=true;
|
|
|
+ end;
|
|
|
+ P^:=Char(Ord(P^)+Adjustment);
|
|
|
+ end;
|
|
|
+ Inc(P);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
|
|
|
-Function UpperCase(Const S : String) : String;
|
|
|
|
|
|
-Var
|
|
|
- i : Integer;
|
|
|
- P : PChar;
|
|
|
+{ UpperCase returns a copy of S where all lowercase characters ( from a to z )
|
|
|
+ have been converted to uppercase }
|
|
|
+Function UpperCase(Const S : AnsiString) : AnsiString;
|
|
|
+ begin
|
|
|
+ Result:=InternalChangeCase(S,['a'..'z'],-32);
|
|
|
+ end;
|
|
|
|
|
|
-begin
|
|
|
- Result := S;
|
|
|
- if not assigned(pointer(result)) then exit;
|
|
|
- UniqueString(Result);
|
|
|
- P:=Pchar(pointer(Result));
|
|
|
- for i := 1 to Length(Result) do
|
|
|
- begin
|
|
|
- if (P^ in ['a'..'z']) then P^ := char(byte(p^) - 32);
|
|
|
- Inc(P);
|
|
|
- end;
|
|
|
-end;
|
|
|
|
|
|
{ LowerCase returns a copy of S where all uppercase characters ( from A to Z )
|
|
|
have been converted to lowercase }
|
|
|
+Function Lowercase(Const S : AnsiString) : AnsiString;
|
|
|
+ begin
|
|
|
+ Result:=InternalChangeCase(S,['A'..'Z'],32);
|
|
|
+ end;
|
|
|
|
|
|
-Function Lowercase(Const S : String) : String;
|
|
|
-
|
|
|
-Var
|
|
|
- i : Integer;
|
|
|
- P : PChar;
|
|
|
-
|
|
|
-begin
|
|
|
- Result := S;
|
|
|
- if not assigned(pointer(result)) then exit;
|
|
|
- UniqueString(Result);
|
|
|
- P:=Pchar(pointer(Result));
|
|
|
- for i := 1 to Length(Result) do
|
|
|
- begin
|
|
|
- if (P^ in ['A'..'Z']) then P^ := char(byte(p^) + 32);
|
|
|
- Inc(P);
|
|
|
- end;
|
|
|
-end;
|
|
|
|
|
|
function LowerCase(const V: variant): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
|
|
begin
|