Cross-post stopped by restricting to objc-language.
On 7 Mar 2010, at 6:07 PM, Marx Bievor wrote:
> I can substitute a String with %@ and an int with %d... like in return @"Hi I am %@ and %d years old", name, age;
> what is the right command to substitute a bool and a float? I cannot find any reference at apple's docs.
> does anyone have a list of those commands?
%@ takes an object pointer, sends it -description, and puts the resulting string into the output. Be careful when you say, "I can substitute a String with %@." You can convert an NSString _object_ (it responds to -description), but you cannot convert a char*, an ordinary C string (which isn't an object at all).
For the rest of the conversions, NSLog follows the format used by printf() from the standard C library. Type "man 3 printf" in the Terminal for a complete list. You should be able to find the same through Google by searching for "man 3 printf".
If you're not familiar with printf(), you may want to pick up a primer on the C (not Objective-, just plain) programming language. printf() is pretty basic stuff.
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden