1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 17:17:31 +00:00

trivial tweak to betterComponentsSeparatedByCharactersInSet:

This commit is contained in:
Mitchell Livingston 2011-09-24 19:38:04 +00:00
parent 246d6a72a3
commit 4ff20ab627

View file

@ -191,21 +191,19 @@
{ {
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)];
if (range.location != i) if (range.location == NSNotFound)
{ {
if (range.location == NSNotFound) [components addObject: [self substringFromIndex: i]];
{ break;
[components addObject: [self substringFromIndex: i]];
break;
}
else
{
const NSUInteger length = range.location - i;
[components addObject: [self substringWithRange: NSMakeRange(i, length)]];
i += length;
}
} }
else if (range.location != i)
{
const NSUInteger length = range.location - i;
[components addObject: [self substringWithRange: NSMakeRange(i, length)]];
i += length;
}
i += range.length; i += range.length;
} }