Author: zoltan
Date: 2006-01-31 15:36:44 -0500 (Tue, 31 Jan 2006)
New Revision: 56362

Modified:
   branches/mono-1-1-13/mcs/class/corlib/System/ChangeLog
   branches/mono-1-1-13/mcs/class/corlib/System/String.cs
Log:
Merge from HEAD.


Modified: branches/mono-1-1-13/mcs/class/corlib/System/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/corlib/System/ChangeLog      2006-01-31 
20:35:47 UTC (rev 56361)
+++ branches/mono-1-1-13/mcs/class/corlib/System/ChangeLog      2006-01-31 
20:36:44 UTC (rev 56362)
@@ -1,3 +1,7 @@
+2006-01-31  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * String.cs: Implement one of the new net 2.0 Split methods.
+
 2006-01-31  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * String.cs : (LastIndexOf) Fixed bug #77412. It should not expect

Modified: branches/mono-1-1-13/mcs/class/corlib/System/String.cs
===================================================================
--- branches/mono-1-1-13/mcs/class/corlib/System/String.cs      2006-01-31 
20:35:47 UTC (rev 56361)
+++ branches/mono-1-1-13/mcs/class/corlib/System/String.cs      2006-01-31 
20:36:44 UTC (rev 56362)
@@ -219,8 +219,24 @@
 
                        if (!removeEmpty)
                                return Split (separator, count);
-                       else
-                               throw new NotImplementedException ();
+                       else {
+                               /* FIXME: Optimize this */
+                               String[] res = Split (separator, count);
+                               int n = 0;
+                               for (int i = 0; i < res.Length; ++i)
+                                       if (res [i] == String.Empty)
+                                               n ++;
+                               if (n > 0) {
+                                       String[] arr = new String [res.Length - 
n];
+                                       int pos = 0;
+                                       for (int i = 0; i < res.Length; ++i)
+                                               if (res [i] != String.Empty)
+                                                       arr [pos ++] = res [i];
+                                       return arr;
+                               }
+                               else
+                                       return res;
+                       }
                }
 
                [ComVisible (false)]

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to