Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-03-2012, 02:35 AM   #1 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 17
harikrsna is on a distinguished road
Default Problem in adding objects in array

Assume that i have one array like this,
NSArray * arr=[[NSArray alloc] initWithObjects:@"1",@"2",@"",@"4",@"5",nil];
for me once it reaches empty object (index 2),it should take next object and go on..
output has 1 2 4 5 ..
how to make condition?
Thanks in advance..
harikrsna is offline   Reply With Quote
Old 01-03-2012, 01:10 PM   #2 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Seattle, WA
Posts: 408
RickSDK is on a distinguished road
Default

its unclear what you are asking or what you are trying to do. The headline mentions "adding" objects to an array. remember you can only add objects to an NSMutableArray.
__________________
Check out my apps

RickSDK is offline   Reply With Quote
Old 01-03-2012, 01:28 PM   #3 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

Quote:
Originally Posted by harikrsna View Post
Assume that i have one array like this,
NSArray * arr=[[NSArray alloc] initWithObjects:@"1",@"2",@"",@"4",@"5",nil];
for me once it reaches empty object (index 2),it should take next object and go on..
output has 1 2 4 5 ..
how to make condition?
Thanks in advance..
In terms of just outputting the values that are not empty, something simple like the following would work:
Code:
for( NSString* str in arr )
{
   //skip over the empty ones
   if( [ str isEqualToString: @""] ) continue;  
 
   NSLog(@"%@,", str);
}
smithdale87 is offline   Reply With Quote
Reply

Bookmarks

Tags
array, array objects

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 398
12 members and 386 guests
buggen, EvilElf, guusleijsten, j.b.rajesh@gmail.com, LunarMoon, morterbaher, QuantumDoja, sacha1996, Sami Gh, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,673
Threads: 94,122
Posts: 402,907
Top Poster: BrianSlick (7,990)
Welcome to our newest member, morterbaher
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:32 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0