Changeset 7386


Ignore:
Timestamp:
Dec 14, 2008, 3:58:17 PM (10 years ago)
Author:
livings124
Message:

slight improvement for the auto-group code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/GroupsController.m

    r7364 r7386  
    471471       
    472472        NSStringCompareOptions options = NSCaseInsensitiveSearch;
    473         if ([place isEqualToString: @"ends"])
    474             options += NSBackwardsSearch;
     473        if ([place isEqualToString: @"begins"])
     474            options += NSAnchoredSearch;
     475        else if ([place isEqualToString: @"ends"])
     476            options += NSBackwardsSearch + NSAnchoredSearch;
     477        else;
    475478       
    476479        NSEnumerator * enumerator = [values objectEnumerator];
     
    479482        {
    480483            NSRange result = [value rangeOfString: givenValue options: options];
    481            
    482             if ([place isEqualToString: @"begins"])
    483                 match = result.location == 0;
    484             else if ([place isEqualToString: @"contains"])
    485                 match = result.location != NSNotFound;
    486             else if ([place isEqualToString: @"ends"])
    487                 match = NSMaxRange(result) == [value length];
    488             else
    489                 break;
     484            match = result.location != NSNotFound;
    490485        }
    491486       
Note: See TracChangeset for help on using the changeset viewer.