Re: "Tricks" of the "Trade"
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.