Re: characters in cocoa
Re: characters in cocoa
- Subject: Re: characters in cocoa
- From: Charles Steinman <email@hidden>
- Date: Fri, 7 Sep 2007 08:35:39 -0700 (PDT)
--- Hans van der Meer <email@hidden> wrote:
> 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?
I don't feel the signedness of characters is a
particularly big roadblock in general. A bigger issue
is ensuring that you deal correctly with Unicode --
one C char in UTF-8 encoding doesn't necessarily
correspond to one glyph.
> 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?
Because there's not generally a need for it? If you
really just need to hold a unichar in some non-string
object, NSValue would do the trick. Normally, though,
NSString is the class for storing characters.
I think the question is: What is it you're trying to
accomplish here? You're telling us *how* you want to
accomplish it, but it seems to be a little different
from how things are normally done in Cocoa. If you
tell us *what* you want to do, we can suggest
Cocoa-friendly ways of doing it.
Cheers,
Chuck
____________________________________________________________________________________
Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.
http://sims.yahoo.com/
_______________________________________________
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