• 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
NSString format specifiers (was: Is Concatenation that complex?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSString format specifiers (was: Is Concatenation that complex?)


  • Subject: NSString format specifiers (was: Is Concatenation that complex?)
  • From: Allan Odgaard <email@hidden>
  • Date: Wed, 28 Apr 2004 02:59:52 +0200

On 27. Apr 2004, at 22:39, Gwynne wrote:

[...] The only difference between printf() specifiers and NSString/CFString specifiers is that the latter add %C (Unicode/wchar_t version of %c), %S (Unicode/wchar_t version of %s),

No, these things are also supported for the stdlib, where S is short for ls (wchar_t*) and C is short for lc (wchar_t). The documentation says:
For each wide character in the string, the
(potentially multi-byte) sequence representing
the wide character is written, including any
shift sequences [...]
But I don't think it actually works for non 8 bit characters.

and %@ (any Cocoa or CoreFoundation object, as the result of [object description] or CFCopyDescription(object).) Someone correct me if I forgot or misrepresented any :).

CFString/NSString also supports reordering of arguments, e.g.:
NSLog(@"%2$@ %1$@", @"world", @"hello");
Which will print "hello world". This is very useful for localizing.

But it fails to support the 'z' modifier (used for size_t). Maybe if they would document their supported format specifiers/placeholders, I would know wether or not this is a bug ;)





--
et al: used as an abbreviation when referring to a number of people, for
example: "It has been improved by Knuth et al." [syn: and others, et alii]

etc: continuing in the same way [syn: and so forth, and so on, et cetera].
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: NSString format specifiers (was: Is Concatenation that complex?)
      • From: "Louis C. Sacha" <email@hidden>
    • Re: NSString format specifiers (was: Is Concatenation that complex?)
      • From: Gwynne <email@hidden>
References: 
 >Is Concatenation that complex? (From: Adam <email@hidden>)
 >Re: Is Concatenation that complex? (From: Marco Scheurer <email@hidden>)
 >Re: Is Concatenation that complex? (From: Finlay Dobbie <email@hidden>)
 >Re: Is Concatenation that complex? (From: Bob Ippolito <email@hidden>)
 >Re: Is Concatenation that complex? (From: Gwynne <email@hidden>)

  • Prev by Date: Re: Transparency?
  • Next by Date: Re: NSStreamEventHasBytesAvailable not getting thrown
  • Previous by thread: Re: Is Concatenation that complex?
  • Next by thread: Re: NSString format specifiers (was: Is Concatenation that complex?)
  • Index(es):
    • Date
    • Thread