Bläddra i källkod

--- Merging r47068 into '.':
U rtl/objpas/sysutils/syshelp.inc
U rtl/objpas/sysutils/syshelph.inc
--- Recording mergeinfo for merge of r47068 into '.':
U .

# revisions: 47068
r47068 | michael | 2020-10-09 13:21:30 +0200 (Fri, 09 Oct 2020) | 1 line
Changed paths:
M /trunk/rtl/objpas/sysutils/syshelp.inc
M /trunk/rtl/objpas/sysutils/syshelph.inc

* Patch from Werner Pamler to implement TStringSplitOptions.ExcludeLastEmpty

git-svn-id: branches/fixes_3_2@47099 -

marco 4 år sedan
förälder
incheckning
c2bd150407
2 ändrade filer med 11 tillägg och 1 borttagningar
  1. 10 0
      rtl/objpas/sysutils/syshelp.inc
  2. 1 1
      rtl/objpas/sysutils/syshelph.inc

+ 10 - 0
rtl/objpas/sysutils/syshelp.inc

@@ -1232,6 +1232,11 @@ begin
       Inc(Len);
       end;
     end;
+
+  if (TStringSplitOptions.ExcludeLastEmpty=Options) then
+    if (Len > 0) and (Result[Len-1] = '') then
+      dec(Len);
+
   SetLength(Result,Len);
 end;
 
@@ -1318,6 +1323,11 @@ begin
       Inc(Len);
       end;
     end;
+
+  If (TStringSplitOptions.ExcludeLastEmpty=Options) then
+    if (Len > 0) and (Result[Len-1] = '') then
+      dec(Len);
+
   SetLength(Result,Len);
 end;
 

+ 1 - 1
rtl/objpas/sysutils/syshelph.inc

@@ -52,7 +52,7 @@ Type
   TCompareOptions = system.TCompareOptions;
 
 {$SCOPEDENUMS ON}
-  TStringSplitOptions = (None, ExcludeEmpty);
+  TStringSplitOptions = (None, ExcludeEmpty, ExcludeLastEmpty);
 {$SCOPEDENUMS OFF}
 
   { TStringHelper }