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

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

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
How to check if an image is within a particular subview. BarryK88 iPhone/iPad Programming 2 Apr 15, 2011 03:18 AM
How to check if a port is open and how to open one seanpc OS X 2 Jun 9, 2010 04:34 PM
How to check if an NSCell is focused? ranguvar Mac Programming 0 Dec 9, 2009 12:43 PM
I need a way to see if an NSString is contains by another ausername iPhone/iPad Programming 1 Apr 13, 2009 08:40 PM
possible to check if an application is open with AppleScript? mjdth Mac Programming 1 Jan 23, 2006 12:19 AM


All times are GMT -5. The time now is 12:22 PM.

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

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