bugGNUstep - Bugs: bug #20169, NSPredicate failed to find...

Group
 
 

bug #20169: NSPredicate failed to find substring with 'IN' operation

Submitter:  -Deleted Account- <yjchen>
Submitted:  Wed 13 Jun 2007 11:06:49 PM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 20 Jun 2007 01:00:40 AM UTC, comment #2: 

I can confirm it is fixed in svn.
Thanx.

-Deleted Account- <yjchen>
Thu 14 Jun 2007 05:20:50 AM UTC, comment #1: 

I think I fixed this in svn trunk ... please let me know if the change is OK.

Richard Frith-Macdonald <CaS>
Group Member
Wed 13 Jun 2007 11:06:49 PM UTC, original submission:  

'CONTAINS' works:

    NSString *string = @"AABBBAA";
    p = [NSPredicate predicateWithFormat: @"%@ CONTAINS %@", @"AABBBAA", @"BBB"];
    UKTrue([p evaluateWithObject: string]);

But 'IN' fails:

    NSString *string = @"AABBBAA";
    p = [NSPredicate predicateWithFormat: @"%@ IN %@", @"BBB", @"AABBBAA"];
    UKTrue([p evaluateWithObject: string]);

Here is the description of 'IN' for Cocoa:

NSInPredicateOperatorType

    A predicate to determine if the left hand side is in the right hand side.

    For strings, returns YES if the left hand side is a substring of the right hand side . For collections, returns YES if the left hand side is in the right hand side .

    Available in Mac OS X v10.4 and later.

-Deleted Account- <yjchen>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by yjchen (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-06-20 CaS Open/ClosedIn Test Closed
    2007-06-14 CaS StatusNone Fixed
        Open/ClosedOpen In Test

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code