• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: question about null
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question about null


  • Subject: Re: question about null
  • From: Todd Ransom <email@hidden>
  • Date: Thu, 1 Mar 2007 17:00:22 -0500

try:

if ([value isKindOfClass: [NSNull class]])

Todd Ransom
Return Self Software
http://returnself.com



On Feb 27, 2007, at 5:58 PM, Glenn Zelniker wrote:

I am using a SQLite database and I have a query that returns a string that may be stored in the database as NULL (not nil or NSNull -- rather, the NULL value that's specific to SQL). I am trying to detect the NULL return value programatically. When I NSLog the value to the Run Log, it prints out as <null>. How can I test for this condition programatically? I've tried

if (value == nil)

if (value = NULL)

if ([value isEqualToString:@""]);

if (value == [NSNull null]);

and none of these seems to work. I'm puzzled. Perhaps the SQL part of my explanation is a red herring. Let me rephrase. I have an NSString called *value. If I do the following:

NSLog(@"%@", value),

I get the following output in the Run Log: <null>

How can I test "value" to catch the condition where value != nil and yet logging value results in <null> ?

Glenn Zelniker

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: RE: How to capture my desktop?
  • Next by Date: Preventing application from becoming active (urgently needed)
  • Previous by thread: RE: How to capture my desktop?
  • Next by thread: Preventing application from becoming active (urgently needed)
  • Index(es):
    • Date
    • Thread