Changeset 12910


Ignore:
Timestamp:
Sep 24, 2011, 7:38:04 PM (10 years ago)
Author:
livings124
Message:

trivial tweak to betterComponentsSeparatedByCharactersInSet:

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/NSStringAdditions.m

    r12901 r12910  
    192192        const NSRange range = [self rangeOfCharacterFromSet: separator options: 0 range: NSMakeRange(i, [self length]-i)];
    193193       
    194         if (range.location != i)
     194        if (range.location == NSNotFound)
    195195        {
    196             if (range.location == NSNotFound)
    197             {
    198                 [components addObject: [self substringFromIndex: i]];
    199                 break;
    200             }
    201             else
    202             {
    203                 const NSUInteger length = range.location - i;
    204                 [components addObject: [self substringWithRange: NSMakeRange(i, length)]];
    205                
    206                 i += length;
    207             }
     196            [components addObject: [self substringFromIndex: i]];
     197            break;
    208198        }
     199        else if (range.location != i)
     200        {
     201            const NSUInteger length = range.location - i;
     202            [components addObject: [self substringWithRange: NSMakeRange(i, length)]];
     203           
     204            i += length;
     205        }
     206       
    209207        i += range.length;
    210208    }
Note: See TracChangeset for help on using the changeset viewer.