1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-22 14:10:34 +00:00

improvements to betterComponentsSeparatedByCharactersInSet:

This commit is contained in:
Mitchell Livingston 2011-09-19 01:55:52 +00:00
parent aead1caae1
commit e0278e8d52

View file

@ -186,7 +186,8 @@
{ {
NSMutableArray * components = [NSMutableArray array]; NSMutableArray * components = [NSMutableArray array];
for (NSUInteger i = 0; i < [self length];) NSUInteger i = 0;
while (i < [self length])
{ {
const NSRange range = [self rangeOfCharacterFromSet: separator options: 0 range: NSMakeRange(i, [self length]-i)]; const NSRange range = [self rangeOfCharacterFromSet: separator options: 0 range: NSMakeRange(i, [self length]-i)];
@ -201,8 +202,9 @@
if (range.location == NSNotFound) if (range.location == NSNotFound)
break; break;
i += length + range.length; i += length;
} }
i += range.length;
} }
return components; return components;