• 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
characters in cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

characters in cocoa


  • Subject: characters in cocoa
  • From: Hans van der Meer <email@hidden>
  • Date: Fri, 7 Sep 2007 11:17:07 +0200

This is a question about the treatment of characters in Cocoa. Because my program will do a lot with individual characters, both as basic type as well as encapsulated in objects, I am anxious to get it right from the start. I feel I should refrain in Cocoa as much as possible from working with plain C's char's, especially in the light of the (unsigned char) - (signed char) dilemma. Is that correct?

The NSString class works with characters in Unicode, as is told in the "String Programming Guide for Cocoa". Its method characterAtIndex retrieves its contents as type unichar and this is typedef'ed in NSString.h as unsigned short. The NSNumber class then has methods like numberWithUnsignedShort but not more descriptive ones for unichar characters like numberWithUnichar; allthough otherwise the use of Unicode is so clearly present in NSString. Does someone know why this is missing?

In fact I would prefer handling character objects with something like NSCharacter (for example as a subclass of NSNumber), but there seems to be not one among the Foundation classes. I feel myself not up to the task of subclassing in a class cluster. Maybe someone has already made one as a subclass of NSNumber?

I would be obliged to hear from the experts what is considered the most appropriate way to handle characters in Cocoa programming. Thanks in advance.

Hans van der Meer



_______________________________________________

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


  • Follow-Ups:
    • Re: characters in cocoa
      • From: Douglas Davidson <email@hidden>
    • Re: characters in cocoa
      • From: Charles Steinman <email@hidden>
    • Re: characters in cocoa
      • From: "Lukhnos D. Liu" <email@hidden>
  • Prev by Date: NSPopUpButton & NSPopUpButtonCell in Table set to same NSMenu causes draw glitch
  • Next by Date: Re: characters in cocoa
  • Previous by thread: NSPopUpButton & NSPopUpButtonCell in Table set to same NSMenu causes draw glitch
  • Next by thread: Re: characters in cocoa
  • Index(es):
    • Date
    • Thread