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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:20:32+00:00 2026-05-26T21:20:32+00:00

NSMutableArray*array = [[NSMutableArray alloc]init]; NSArray*Somearray = [NSArray arrayWithObjects:1st Object,2ndObject,3rd Object,4th object,5th Object,nil]; In the

  • 0
NSMutableArray*array = [[NSMutableArray alloc]init];

NSArray*Somearray = [NSArray arrayWithObjects:1st Object,2ndObject,3rd Object,4th object,5th Object,nil];

In the above array 1st Object,2ndObject,3rd Object,4th object,5th Object having val,content,conclusion in each index.

for(int i=0;i<[Somearray count];i++)
{

______________

Here the code is there to give each index ,that is having val,content,conclusion ..

After that  val,content,conclusion in each index will be add to Dict..
____________


NSDictionary *Dict = [NSDictionary dictionaryWithObjectsAndKeys:val,@"val",content,@"content",conclusion,@"conclusion",nil];

//Each time adding dictionary into array;

[array addObject:Dict];

}

The above Dictionary is in for loop and the keyvalue pairs will be add 5 times(Somearray Count).Now array is having in

array = [{val="1.1 this is first one",content="This is the content of 0th index",conclusion="this is  the conclusion of 0th index"},{val="1.2 this is first one",content="This is the content of 1st index",conclusion="this is  the conclusion of 1st index"},____,____,______,{val="1.5 this is first one",content="This is the content of 4th index",conclusion="this is  the conclusion of 4th index"},nil];

Now i am having NSString*string = @"1.5";

Now i need the index where val is having 1.5 in it.How to send the str in to array to find the the index.

Can anyone share the code please.

Thanks in advance.

  • 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-26T21:20:32+00:00Added an answer on May 26, 2026 at 9:20 pm
     NSUInteger idx = UINT_MAX;
        NSCharacterSet* spaceSet = [NSCharacterSet whitespaceCharacterSet];
        for(int i=0,i_l=[Yourarray count];i<i_l;i++) {
            NSString* s_prime = [[Yourarray objectAtIndex:i] valueForKey:@"val"];
            if ([s_prime length] < 4) {
                continue;
            }
            NSString *subString = [[s_prime substringToIndex:4] stringByTrimmingCharactersInSet:spaceSet];
           // NSLog(@"index %@",s);
            if ([subString isEqualToString:secretNumber]){
                idx = i;
                break;
            }
        }
        if (idx != UINT_MAX) {
          //  NSLog(@"Found at index: %d",idx);
        } else {
         //   NSLog(@"Not found");
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

-(NSArray*)getSomeStuff { NSMutableArray *array = [[NSMutableArray alloc]init]; // Add some objects to array return
NSMutableArray *a1 = [[NSMutableArray alloc] init]; NSMutableArray *a2 = [NSMutableArray array]; TempObj *obj =
I have a simple code: NSMutableArray *arrayCheckList = [[NSMutableArray alloc] init]; [arrayCheckList addObject:[NSMutableDictionary dictionaryWithObjects:[NSArray
NSMutableArray *insideArray = [[NSMutableArray alloc] init]; NSMutableArray *outsideArray = [[NSMutableArray alloc] init]; [insideArray addObject:@Hello
arr = [[NSMutableArray alloc]init]; [arr addObject:[NSNumber numberWithInt:4]]; [arr addObject:[NSNumber numberWithInt:45]]; [arr addObject:[NSNumber numberWithInt:23]]; [arr
In this code: - (void)connectionDidFinishLoading:(NSURLConnection *)connection { //---initialize the array--- listOfJMovies = [[NSMutableArray alloc]
I can declare NSMutableArray or NSArray but I want to declare class array. Let
I'm using the following method in my code: - (NSMutableArray *) newOrderedArray:(NSMutableArray *)array ByKey:(NSString
I have an NSMutableArray. It's members eventually become members of an array instance in
How can I access @public NSArray or NSMutableArray after updating it? From one class

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.