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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:22:28+00:00 2026-05-17T01:22:28+00:00

I want to copy items from an array that are not 0 or @

  • 0

I want to copy items from an array that are not 0 or @”” (depending if NSNumber or NSString). The following code, however, does not work. What am I doing wrong?

for (int i=0; i < [logbookItems count]; i++) {
    NSLog(@"%@, %@, %@", [[[logbookItems objectAtIndex:i] objectAtIndex:1] class], [[logbookItems objectAtIndex:i] objectAtIndex:0], [[logbookItems objectAtIndex:i] objectAtIndex:1]);
    if ((([[[logbookItems objectAtIndex:i] objectAtIndex:1] isKindOfClass:[NSNumber class]]) && ([[logbookItems objectAtIndex: i] objectAtIndex: 1] > 0))
        || (([[[logbookItems objectAtIndex:i] objectAtIndex:1] isKindOfClass:[NSString class]]) && ([[logbookItems objectAtIndex: i] objectAtIndex: 1] != @""))) {
        [visibleLogbookItems addObject: [logbookItems objectAtIndex: i]];
    }
}

It produces the following log:

2010-10-01 12:46:48.301 PilotsMate[1750:207] (
21,
10,
1985,
"Test AC Mark",
"",
"",
"",
"Test Mission",
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
)
2010-10-01 12:46:52.996 PilotsMate[1750:207] NSCFNumber, Day: , 21
2010-10-01 12:46:52.997 PilotsMate[1750:207] NSCFNumber, Month: , 10
2010-10-01 12:46:52.997 PilotsMate[1750:207] NSCFNumber, Year: , 1985
2010-10-01 12:46:52.998 PilotsMate[1750:207] NSCFString, Aircraft Type: , Test AC Mark
2010-10-01 12:46:52.998 PilotsMate[1750:207] NSCFString, Airframe Number: , 
2010-10-01 12:46:52.999 PilotsMate[1750:207] NSCFString, Pilot: , 
2010-10-01 12:46:53.000 PilotsMate[1750:207] NSCFString, Crew: , 
2010-10-01 12:46:53.000 PilotsMate[1750:207] NSCFString, Mission: , Test Mission
2010-10-01 12:46:53.001 PilotsMate[1750:207] NSCFNumber, Pilot Hours (Day): , 0
2010-10-01 12:46:53.002 PilotsMate[1750:207] NSCFNumber, Crew Hours (Day): , 0
2010-10-01 12:46:53.002 PilotsMate[1750:207] NSCFNumber, Pilot Hours (Night): , 0
2010-10-01 12:46:53.003 PilotsMate[1750:207] NSCFNumber, Crew Hours (Night): , 0
2010-10-01 12:46:53.004 PilotsMate[1750:207] NSCFNumber, Simulator Hours: , 0
2010-10-01 12:46:53.005 PilotsMate[1750:207] NSCFNumber, IF Simulated: , 0
2010-10-01 12:46:53.006 PilotsMate[1750:207] NSCFNumber, IF Actual: , 0
2010-10-01 12:46:53.006 PilotsMate[1750:207] NSCFNumber, No. of SRA: , 0
2010-10-01 12:46:53.008 PilotsMate[1750:207] NSCFNumber, No. of PAR: , 0
2010-10-01 12:46:53.009 PilotsMate[1750:207] NSCFNumber, No. of ILS: , 0
2010-10-01 12:46:53.020 PilotsMate[1750:207] NSCFNumber, No. of GPS: , 0
2010-10-01 12:46:53.023 PilotsMate[1750:207] NSCFNumber, No. of SCA: , 0
2010-10-01 12:46:53.024 PilotsMate[1750:207] NSCFNumber, No. of ELVA: , 0
2010-10-01 12:46:53.025 PilotsMate[1750:207] NSCFNumber, DL (Day): , 0
2010-10-01 12:46:53.028 PilotsMate[1750:207] NSCFNumber, DL (Night - Conventional): , 0
2010-10-01 12:46:53.030 PilotsMate[1750:207] NSCFNumber, DL (Night - NVG): , 0
2010-10-01 12:46:53.030 PilotsMate[1750:207] NSCFNumber, GFP: , 0
2010-10-01 12:46:53.031 PilotsMate[1750:207] NSCFNumber, IFP: , 0
2010-10-01 12:46:53.032 PilotsMate[1750:207] NSCFNumber, NVG: , 0
2010-10-01 12:46:53.032 PilotsMate[1750:207] NSCFNumber, RNFA: , 0
2010-10-01 12:46:53.033 PilotsMate[1750:207] NSCFNumber, Instructional Hours (Day): , 0
2010-10-01 12:46:53.033 PilotsMate[1750:207] NSCFNumber, Instructional Hours (Night): , 0
  • 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-17T01:22:28+00:00Added an answer on May 17, 2026 at 1:22 am

    First change this :

    ([[logbookItems objectAtIndex: i] objectAtIndex: 1] != @"")
    

    to :

    (![[[logbookItems objectAtIndex: i] objectAtIndex: 1] isEqualToString:@""]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to copy a file from A to B in C#. How do
I want to copy text files and only text files from src/ to dst/
I have a situation where I want to copy the output assembly from one
I have a QGraphicsScene that I want to copy and append to the start
I have a string (of undertermined length) that I want to copy a lot
I want to copy a live production database into my local development database. Is
Say I want to copy the contents of a directory excluding files and folders
I'm cloning a TClientDataSet and I want to copy all the fields to the
I'm building an Android app and I want to copy the text value of
Specifically, I want to copy a link (with text and location) and then to

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.