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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:05:00+00:00 2026-05-30T02:05:00+00:00

I have a simple predicate function that follows as: [totalSentences addObjectsFromArray:[firstLangEx filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@(SELF contains[c]

  • 0

I have a simple predicate function that follows as:

[totalSentences addObjectsFromArray:[firstLangEx filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"(SELF contains[c] %@)", cellText]]];

This line works in one of my apps, however it does not work when I copied this into another app and tried testing this.

totalSentences is a global NSMutableArray

firstLangEx is a local NSArray filled with several lines

cellText is  NSString *cellText = cell.textLabel.text;

All these codes exist in my original app and work. They are implemented in the method - (void)tableView:(UITableView *)tableView1 didSelectRowAtIndexPath:(NSIndexPath *)indexPath

Even cellText does match one string in firstLangEx in the another app, totalSentences is never filled with any character.

What could cause this?


EDIT:

In NSLog

totalSentences always shows no content, contrary to the output in the original app which always shows at least one line.

firstLangEx does always have correct content loaded from a text file (In both apps the files are same)

cellText does always shows at least one string. (I test same strings in both apps.)

So I have no idea why totalSentences is always empty, when it should be filled with at least one string which matches all cellText strings.


EDIT:

I have also added some strings to totalSentences programmatically and the mutable array works well. Any idea why this happens?


EDIT:

I have tested as yuji suggested:

BOOL ok;

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF contains[c] %@", cellText];

ok = [predicate evaluateWithObject: firstLangEx];

NSLog (@"Bool ok %d", ok);

The outcome is always “Bool ok 0”.

cellText was “Babylonian” and one line from firstLangEx does contain this: “[E: The way an ancient Babylonian might have written it.]”.

So what did I do wrongly?


EDIT:

I use this code

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    NSString *cellText = cell.textLabel.text;

in

- (void)tableView:(UITableView *)tableView1 didSelectRowAtIndexPath:(NSIndexPath *)indexPath

in order to extract the string to match a string from my array.

However, it never gets matched, as

NSLog (@"cellText length %d", [cellText length]);

always show that cellText has always one extra character, even there is no white space or extra character in my array that my table view is loaded from. For example, “Babylonian” is 10 characters and the log showed this amount in the original app, but it showed 11 characters in the other app, even both apps use same files to table view.

Why does this happen?

  • 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-30T02:05:01+00:00Added an answer on May 30, 2026 at 2:05 am

    Since there is no answer to my question, I will answer as I have found the solution. It would be nice if yuji would be awarded for his contribution.

    I solved it by copying the content of the files that feed table view into new files with other names, and suddenly the extra invisible character for all cells disappeared. Is this common problem? Anyway, it is solved now, yay! Thanks to yuji.

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

Sidebar

Related Questions

I have simple win service, that executes few tasks periodically. How should I pass
I have simple WinForms application where modifying Windows Registry. The problem is that in
In my iOS application I have a really simple predicate for my fetch controller.
I have a simple base entity type called EntityBase that implements IEquatable<EntityBase>. I've used
I'm trying to write predicate function for use with STL algorithms. I see that
I have a simple HTML input file; which contains a table. The column headers
I have a simple TCP server that communicates with some devices via GPRS. It
I have a simple table that has an NSFetchedResultsController. It uses the current date
I have simple regex \.*\ for me its says select everything between and ,
i have simple regular expression: ^123$ Matches are for example 123 1234 etc. How

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.