]> granicus.if.org Git - transmission/commitdiff
even more work on betterComponentsSeparatedByCharactersInSet:
authorMitchell Livingston <livings124@transmissionbt.com>
Mon, 19 Sep 2011 02:00:52 +0000 (02:00 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Mon, 19 Sep 2011 02:00:52 +0000 (02:00 +0000)
macosx/NSStringAdditions.m

index d4e2f794adcbc1264dc13a5e2079410511269113..84a6df2a897b165c5283ccf79b7c14ae8f4b5188 100644 (file)
         
         if (range.location != i)
         {
-            NSUInteger length;
-            if (range.location == NSNotFound)
-                length = [self length] - i;
-            else
-                length = range.location - i;
-            [components addObject: [self substringWithRange: NSMakeRange(i, length)]];
-            
             if (range.location == NSNotFound)
+            {
+                [components addObject: [self substringFromIndex: i]];
                 break;
-            i += length;
+            }
+            else
+            {
+                const NSUInteger length = range.location - i;
+                [components addObject: [self substringWithRange: NSMakeRange(i, length)]];
+                
+                i += length;
+            }
         }
         i += range.length;
     }