• 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: "Tricks" of the "Trade"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Tricks" of the "Trade"


  • Subject: Re: "Tricks" of the "Trade"
  • From: Rob Rix <email@hidden>
  • Date: Thu, 7 Jun 2001 04:47:44 -0400

YES, i do agree with you, NSLog() is a wonderful tool. But, I have a
question, if you want to NSLog() to print the value of an int, is there a
better way than NSLog([[NSNumber numberWithInt:i] stringValue])?

NSLog acts like printf, AFAIK, so you can do something like this:

NSLog(@"The value of the integer is %d", [NSNumber intValue]);

As far as I know, NSLog accepts %d for integers, %f for floats, %c for chars, %s for char* (C strings), and %@ for objects (you can use this to display NSStrings, or with other objects, some hex values whose meaning escapes me).
It might accept others, such as %x, %o (I think those are hex and octal, but I'm not sure), %b (boolean?), et cetera, but I'm not certain.

-- Rob

This has been a recording.


  • Follow-Ups:
    • Re: "Tricks" of the "Trade"
      • From: Tom Waters <email@hidden>
  • Prev by Date: Problem in viewing with Help Viewer
  • Next by Date: Re: "Tricks" of the "Trade"
  • Previous by thread: Re: "Tricks" of the "Trade"
  • Next by thread: Re: "Tricks" of the "Trade"
  • Index(es):
    • Date
    • Thread