1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +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)];
if (range.location != i)
if (range.location == NSNotFound)
{
if (range.location == NSNotFound)
{
[components addObject: [self substringFromIndex: i]];
break;
}
else
{
const NSUInteger length = range.location - i;
[components addObject: [self substringWithRange: NSMakeRange(i, length)]];
i += length;
}
[components addObject: [self substringFromIndex: i]];
break;
}
else if (range.location != i)
{
const NSUInteger length = range.location - i;
[components addObject: [self substringWithRange: NSMakeRange(i, length)]];
i += length;
}
i += range.length;
}