• 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: Odd display of percent character
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Odd display of percent character (From: Chris Paveglio <email@hidden>)
 >Re: Odd display of percent character (From: Keary Suska <email@hidden>)

  • Prev by Date: Re: Playing Music in Objective C
  • Next by Date: Re: How can I detect a mouse click outside a child window on Leopard?
  • Previous by thread: Re: Odd display of percent character
  • Next by thread: Re: Odd display of percent character
  • Index(es):
    • Date
    • Thread