Quellcode durchsuchen

+ Merged revision 380

git-svn-id: branches/fixes_2_0@381 -
michael vor 20 Jahren
Ursprung
Commit
e3dec34014
1 geänderte Dateien mit 33 neuen und 19 gelöschten Zeilen
  1. 33 19
      rtl/objpas/sysutils/sysstr.inc

+ 33 - 19
rtl/objpas/sysutils/sysstr.inc

@@ -63,30 +63,44 @@ end ;
 {   UpperCase returns a copy of S where all lowercase characters ( from a to z )
 {   UpperCase returns a copy of S where all lowercase characters ( from a to z )
     have been converted to uppercase   }
     have been converted to uppercase   }
 
 
-function UpperCase(const S: string): string;
-var i: integer;
-begin
-result := S;
-i := Length(S);
-while i <> 0 do begin
-   if (result[i] in ['a'..'z']) then result[i] := char(byte(result[i]) - 32);
-   Dec(i);
-   end;
-end;
 
 
+Function UpperCase(Const S : String) : String;
+
+Var
+  i : Integer;
+  P : PChar;
+    
+begin
+  Result := S;
+  UniqueString(Result);
+  P:=Pchar(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 )
 {   LowerCase returns a copy of S where all uppercase characters ( from A to Z )
     have been converted to lowercase  }
     have been converted to lowercase  }
 
 
-function LowerCase(const S: string): string;
-var i: integer;
-begin
-result := S;
-i := Length(result);
-while i <> 0 do begin
-   if (result[i] in ['A'..'Z']) then result[i] := char(byte(result[i]) + 32);
-   dec(i);
-   end;
+Function Lowercase(Const S : String) : String;
+
+Var
+  i : Integer;
+  P : PChar;
+    
+begin
+  Result := S;
+  UniqueString(Result);
+  P:=Pchar(Result);
+  for i := 1 to Length(Result) do
+    begin
+    if (P^ in ['A'..'Z']) then P^ := char(byte(p^) + 32);
+      Inc(P);
+    end;
 end;
 end;
+                            
 
 
 {   CompareStr compares S1 and S2, the result is the based on
 {   CompareStr compares S1 and S2, the result is the based on
     substraction of the ascii values of the characters in S1 and S2
     substraction of the ascii values of the characters in S1 and S2