Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8272259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:04:40+00:00 2026-06-08T07:04:40+00:00

I have a NSPredicate like this: NSPredicate *predicate = [NSPredicate predicateWithFormat:@entity.name CONTAINS %@, myString];

  • 0

I have a NSPredicate like this:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"entity.name CONTAINS %@", myString];

But that will return anything which contains that string. For example:
If my entity.name’s where:

text
texttwo
textthree
randomtext

and the myString was text then all of those strings would match. I would like it so that if myString is text it would only return the first object with the name text and if myString was randomtext it would return the fourth object with the name randomtext. I am also looking for it to be case insensitive and that it ignores whitespace

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:04:41+00:00Added an answer on June 8, 2026 at 7:04 am

    This should do it:

    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"entity.name LIKE[c] %@", myString];
    

    LIKE matches strings with ? and * as wildcards. The [c] indicates that the comparison should be case insensitive.

    If you don’t want ? and * to be treated as wildcards, you can use == instead of LIKE:

    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"entity.name ==[c] %@", myString];
    

    More info in the NSPredicate Predicate Format String Syntax documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that conforms to UISearchDisplayDelegate and contains a UISearchBar. This view
Hi the problem goes like this: I have in CoreData entities that have a
Lets say I have a core data model like this one: Item attributes: name
I have a relation in Core Data like this: A -> B and the
I have an NSArray with CGPoints . I'd like to filter this array by
I have a core data entity that represents the attributes of a product, as
Another way to word this might be... NSPredicate state.country == 'United States' is like
I have an entity A like the following: @interface A : NSManagedObject { }
I have a Core Data model setup like so: Blockbuster Entity To-Many relationship to
This is really annoying me. In Objective-C, I have an Item entity with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.