Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString
Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString
- Subject: Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString
- From: Greg Titus <email@hidden>
- Date: Sun, 11 Jan 2009 10:56:53 -0800
On Jan 11, 2009, at 10:48 AM, Kyle Sluder wrote:
On Sun, Jan 11, 2009 at 2:50 AM, Ken Thomases <email@hidden>
wrote:
Sure it would. Both unichar (as typedef'd) and char are integer
types in C.
'7' is another way of writing a number, although not the number 7.
Which
number depends on the encoding of your source file, but in most
modern
systems it would be ASCII or UTF-8. (I don't know if, for example,
EBCDIC
is still used on any modern systems.) In either of those, '7' is
the same
as 0x37 or 55.
Except I recall that Cocoa often uses UTF-116 or UCS2 internally...
Cocoa does use UTF-16 as the encoding for its unichar type in
NSStrings, but the low 7-bits of UTF-16 (characters 0-127) are
identical to the ASCII encodings, so you can cast (char)'7' or
(unichar)'7' and get 0x37 either way and it'll be interpreted as the
'7' character in a string as you would expect.
Hope this helps,
- Greg
_______________________________________________
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