Re: Odd display of percent character
Re: Odd display of percent character
- Subject: Re: Odd display of percent character
- From: Uli Kusterer <email@hidden>
- Date: Tue, 14 Feb 2012 14:38:56 +0100
On 13.02.2012, at 20:19, Keary Suska wrote:
> % is a format specifier, so you must escape them (by doubling them, "%%") if you are using it as a format string, even if what follows the % is not a known specifier. In your case, "o" means show an unsigned int in octal and the space after the % means pad spaces instead of zeros. The number is being derived from whichever parameter is being eaten up by the specifier. If it is an object, it is converting the pointer address to an int and then showing it in octal. Normally you would get a warning about this, unless you don't have decent warnings set...
In addition to this, whenever I do not actually need a format in a case like NSRunAlertPanel or whatever, I set the string to @"%@" and specify the actual string at the end in the ... section. That way, I don't have to tell my localizers to double their '%' signs in these five strings, or check the string for a '%' sign that some language might use in their translation of whatever the orginal '%'-less message might be.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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