Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 2, 2011, 01:54 AM   #1
teguh123
macrumors member
 
Join Date: Mar 2011
How to Check that an NSString is empty

That work for both

@"" and for nil?
__________________
How to Learn Math
teguh123 is offline   0 Reply With Quote
Old Jun 2, 2011, 04:49 AM   #2
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London


Code:
if (myString != nil && ![myString isEqualToString:@""])
{
}
Due to the fundamental rules of C this is safe to do: if the first comparison fails the second will not get executed.

In all honesty, and please don't take this the wrong way, if you need to ask this it's time to step back and learn the basics properly.
robbieduncan is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
How to check log files to date/time system RAM was changed? Any way to check this? asterix2k10 OS X 1 Mar 7, 2014 08:19 PM
The I may go to bed, and just check back in tomorrow to check my order status thread lsutigerfan1976 iPhone 0 Sep 14, 2012 10:50 PM
Need advice - Check NSString object to see if its a valid word? animefx iPhone/iPad Programming 9 Aug 31, 2012 03:02 PM
sharing option have redundant empty check boxes bicepjai Mac OS X 10.7 Lion 1 Jul 28, 2012 03:20 PM
(NSString*) ?? thedon1 iPhone/iPad Programming 6 Jul 2, 2012 07:52 PM

Forum Jump

All times are GMT -5. The time now is 04:31 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC