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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:16:46+00:00 2026-06-18T03:16:46+00:00

Im new to iphone programming and im kinda stuck with my current project. I

  • 0

Im new to iphone programming and im kinda stuck with my current project. I got a text file with a lot of data in it. Data is sorted like this:

51398030 10003254 80211593/94     1301281744 TOMTOM100  
51398030 10003254 80211593/94     1301281744 TOMTOM101  
51398030 10003254 80211593/94     1301281745 TOMTOM102  
51398030 10003254 80211593/94     1301281745 TOMTOM103  
51398033 10003254 80211595        1301281744 TOMTOM100  
51398033 10003254 80211595        1301281744 TOMTOM101  
51398033 10003254 80211595        1301281745 TOMTOM102  
51398033 10003254 80211595        1301281745 TOMTOM103  
51398029 10003254 80211597/98     1301281744 TOMTOM100  
51398029 10003254 80211597/98     1301281744 TOMTOM101  
51398029 10003254 80211597/98     1301281745 TOMTOM102  
51398029 10003254 80211597/98     1301281745 TOMTOM103

I already imported this txt file and created a NSMutableArray that contains each line as object. Now i have a textfield where the user can enter a number. the app should now look trough the text file and and sort out the lines containing this number.

I already looked at https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Strings/Articles/Scanners.html#//apple_ref/doc/uid/20000147-BCIEFGHC

but i dont know how to start.

This is how far i got:

    NSData *tmpData = [NSData dataWithContentsOfURL:[NSURL       URLWithString:trackTraceFileUrlName] ];
    NSLog(@"%@",trackTraceFileUrlName);
    //convert data to string 
    NSString *tmpString = [[NSString alloc] initWithData:tmpData              encoding:NSUTF8StringEncoding];
    NSArray *piecesArray = [tmpString componentsSeparatedByString:@"\n"];
    NSMutableArray *trackTraceContent = [NSMutableArray arrayWithArray:piecesArray];
    NSLog(@"*%@*",trackTraceContent);
  • 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-18T03:16:47+00:00Added an answer on June 18, 2026 at 3:16 am

    Since you probably want to search over all the lines in the array, and assuming that you array just contains the strings as NSString objects:

    NSArray *stringArray; // assuming that you already have these variables
    NSString *numberEnteredByUser;
    NSPredicate *pred = [NSPredicate predicateWithBlock:^(id obj, NSDictionary *bindings) {
        NSString *str = (NSString *)obj;
        return [str rangeOfString:numberEnteredByUser].location != NSNotFound;
    }];
    NSArray *results = [stringArray filteredArrayUsingPredicate:pred];
    

    Of course, you can also create the target array without using NSPredicate, by just iterating over stringArray and adding the right objects to a NSMutableArray results.

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

Sidebar

Related Questions

I'm pretty new in iphone programming and have stumbled upon this issue which I
I am new to iPhone programming, and stuck in a situation. The situation is
I'm new to iphone programming. there are lot of basic controls in xcode which
I'm new to iPhone programming and I'm trying to use CHDataStructures in my project.
I am new to iPhone Programming I want to read the content of text
I am new to iPhone programming and when I use this code to enable/disable
I am new in iphone programming. I would like to know how can i
I am New To Iphone programming.my Array store UIlabel along with properties.For Exp,Text,TextColor,background color
I'm Very new to Objective-C iPhone programming. I'm kinda gonna go with the trial-and-error
Im new to iPhone programming. And, im trying to make a game with like

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.