Browse Source

* fixed commatext (merged)

peter 25 years ago
parent
commit
bc81df6aa7
1 changed files with 38 additions and 23 deletions
  1. 38 23
      fcl/inc/stringl.inc

+ 38 - 23
fcl/inc/stringl.inc

@@ -103,10 +103,13 @@ begin
   P1:=P+1;
   P1:=P+1;
   While P1^<>#0 do
   While P1^<>#0 do
     begin
     begin
-    If (P1^='"') and (P1[1]<>'"') then
-      break;
-    P1:=P1+1;
-    If P1^='"' then P1:=P1+1;
+      If (P1^='"') then
+       begin
+         if (P1[1]<>'"') then
+          break;
+         inc(p1);
+       end;
+      inc(p1);
     end;
     end;
   // P1 points to last quote, or to #0;
   // P1 points to last quote, or to #0;
   P:=P+1;
   P:=P+1;
@@ -120,25 +123,33 @@ begin
 end;
 end;
 
 
 
 
-Function GetNextQuotedChar (P : PChar; Var S : String): Boolean;
+Function GetNextQuotedChar (var P : PChar; Var S : String): Boolean;
 
 
 Var PS,L : PChar;
 Var PS,L : PChar;
 
 
 begin
 begin
   Result:=False;
   Result:=False;
-  If P^=#0 then exit;
   S:='';
   S:='';
-  While (p^<>#0) and (byte(p^)<=byte(' ')) do P:=P+1;
+  While (p^<>#0) and (byte(p^)<=byte(' ')) do
+   inc(p);
+  If P^=#0 then exit;
   PS:=P;
   PS:=P;
   If P^='"' then
   If P^='"' then
-    S:=GetQuotedString(P)
+   begin
+     S:=GetQuotedString(P);
+     While (p^<>#0) and (byte(p^)<=byte(' ')) do
+      inc(p);
+   end
   else
   else
-    begin
-    While (p^>' ') and (P^<>',') do P:=P+1;
-    Setlength (S,P-PS);
-    L:=Pointer(S);
-    Move (PS^,L,P-PS);
-    end;
+   begin
+     While (p^>' ') and (P^<>',') do
+      inc(p);
+     Setlength (S,P-PS);
+     L:=Pointer(S);
+     Move (PS^,L,P-PS);
+   end;
+  if p^=',' then
+   inc(p);
   Result:=True;
   Result:=True;
 end;
 end;
 
 
@@ -151,7 +162,8 @@ Var P : Pointer;
 begin
 begin
   Self.Clear;
   Self.Clear;
   P:=Pointer(Value);
   P:=Pointer(Value);
-  While GetNextQuotedChar (P,S) do Add (S);
+  While GetNextQuotedChar (P,S) do
+   Add (S);
 end;
 end;
 
 
 
 
@@ -341,7 +353,7 @@ begin
       self.AddObject (Thestrings[Runner],TheStrings.Objects[Runner]);
       self.AddObject (Thestrings[Runner],TheStrings.Objects[Runner]);
   finally
   finally
     EndUpdate;
     EndUpdate;
-  end;    
+  end;
 end;
 end;
 
 
 
 
@@ -360,7 +372,7 @@ begin
     Inherited Assign(Source);
     Inherited Assign(Source);
   finally
   finally
     EndUpdate;
     EndUpdate;
-  end;  
+  end;
 end;
 end;
 
 
 
 
@@ -415,9 +427,9 @@ begin
     Strings[Index1]:=Strings[Index2];
     Strings[Index1]:=Strings[Index2];
     Objects[Index2]:=Obj;
     Objects[Index2]:=Obj;
     Strings[Index2]:=Str;
     Strings[Index2]:=Str;
-  finally  
+  finally
     EndUpdate;
     EndUpdate;
-  end;  
+  end;
 end;
 end;
 
 
 
 
@@ -585,10 +597,10 @@ begin
     beginUpdate;
     beginUpdate;
     Clear;
     Clear;
     While GetNextLine (TheText,S) do
     While GetNextLine (TheText,S) do
-    Add(S); 
+    Add(S);
   finally
   finally
     EndUpdate;
     EndUpdate;
-  end;   
+  end;
 end;
 end;
 
 
 
 
@@ -956,7 +968,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.4  2000-11-17 13:39:49  sg
+  Revision 1.5  2000-11-22 22:44:39  peter
+    * fixed commatext (merged)
+
+  Revision 1.4  2000/11/17 13:39:49  sg
   * Extended Error methods so that exceptions are raised from the caller's
   * Extended Error methods so that exceptions are raised from the caller's
     address instead of the Error method
     address instead of the Error method
 
 
@@ -965,5 +980,5 @@ end;
 
 
   Revision 1.2  2000/07/13 11:33:01  michael
   Revision 1.2  2000/07/13 11:33:01  michael
   + removed logs
   + removed logs
- 
+
 }
 }