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 6896217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:00:28+00:00 2026-05-27T07:00:28+00:00

Is there any way to use an XOR as an operator for an predicate.

  • 0

Is there any way to use an XOR as an operator for an predicate.

I have a File object and I want to know if there is a file available in english. If it’s not available in english, it should return me the german version. If both are available it should not return the german version. This is why I need an XOR.

Example:

[NSPredicate predicateWithFormat:@"file.language = 'en' XOR file.language = 'de'"];

This will return only the english file.

  • 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-05-27T07:00:29+00:00Added an answer on May 27, 2026 at 7:00 am

    As per http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html#//apple_ref/doc/uid/TP40001795-SW1 there does not seem to be such an operator. If needed you would have to use parantheses and convert a XOR b to (a AND NOT b) OR (NOT a and b). In any case, note Henning’s comment about this not helping anyway. One problem in your statement is that it is not balanced, i.e. you want to have the english version to have precedence. The most simplest way would probably be to

    • filter array by file.language = 'en'
    • if that array is empty:
      • filter array by file.language = 'de'

    This way you can ensure the precedence of the english file.

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

Sidebar

Related Questions

Is there any way to use Activex in chrome or other browsers? I want
Is there any way to use IMPLEMENT_DYNCREATE with a template class? If not, why
Is there any way to use a php file in the parent folder. I
Is there any way to use environment variables in the play! application.conf file? Something
Is there any way to use code 2^power without using math.pow or multiplication operator.
Is there any way to use an .h , .c and .so file and
Is there any way to use inheritance in database (Specifically in SQL Server 2005)?
Is there any way to use a constant as a hash key? For example:
Is there any way to use C# to build a container application where each
Is there any way to use AppleScript (or something else) to query currently running

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.