• 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: Inserting Special Characters into a String (small nit being picked)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inserting Special Characters into a String (small nit being picked)


  • Subject: Re: Inserting Special Characters into a String (small nit being picked)
  • From: pjl <email@hidden>
  • Date: Tue, 12 Jul 2005 22:51:58 -0400


On Jul 11, 2005, at 4:16 PM, Ian was here wrote:

Here's the source code for inserting special
characters into a string for anyone who is interested:



char diamondChar[] = { 0xe2, 0x99, 0xa6, nil }; //UTF8

Don't use nil. Use 0 (or even 0x0 for consistency if you like). nil is (id)0, i.e. a pointer to an object. You have an array of 8-bit integers. The compiler can automatically cast the zero back to a char but it's very bad style. Use NULL for pointers, nil for objects, '\0' for character constant for ASCII NUL, and 0 for zero.


NSMutableAttributedString    *bulletedText =
[[NSMutableAttributedString alloc]
initWithString:[NSString
stringWithUTF8String:diamondChar] attributes:attDict];

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Inserting Special Characters into a String (small nit being picked)
      • From: Ian was here <email@hidden>
References: 
 >Re: Inserting Special Characters into a String (From: Ian was here <email@hidden>)

  • Prev by Date: Uniquing NSMetadataItem's
  • Next by Date: Re: Inserting Special Characters into a String (small nit being picked)
  • Previous by thread: Re: Inserting Special Characters into a String
  • Next by thread: Re: Inserting Special Characters into a String (small nit being picked)
  • Index(es):
    • Date
    • Thread