NSComparisonResult - compare entire string?

Discussion in 'iOS Programming' started by forrestgrant, Aug 13, 2008.

  1. forrestgrant macrumors member

    Joined:
    Jun 24, 2008
    #1
    I am using NSComparisonResult like so:
    Code:
    NSString *haystackText = @"Hello World";
    
    NSComparisonResult result = [haystackText compare:searchText options:NSCaseInsensitiveSearch range:NSMakeRange(0, [searchText length])];
    
    So if searchText = @"he" then the result is true.
    But if searchText = @"World", it does not return.

    Is there an option to pass NSComparisonResult to get it to find within the string instead of just an exact match of the beginning?
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Maybe use the rangeOfString:XXX methods instead?
     

Share This Page