• 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: How to add a -(unsigned long long)unsignedLongLongValue method to NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Ken Thomases <email@hidden>
  • Date: Sun, 11 Jan 2009 16:42:21 -0600

On Jan 11, 2009, at 2:22 PM, Kyle Sluder wrote:

On Sun, Jan 11, 2009 at 1:56 PM, Greg Titus <email@hidden> wrote:
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.

Doesn't that depend on the byte order? What happens if the string is stored big-endian with a BOM at the beginning, and you go and read out a unichar?

An NSString, through its character/unichar interface, always provides native endian values. Only if/when you convert to a specific encoding to produce a byte stream does endianness enter into the discussion. But then, you should never be comparing individual bytes from such a stream to character values. You would always need to decode back to (inherently native-endian) character values before doing any character- based operations.


Regards,
Ken

_______________________________________________

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


References: 
 >How to add a -(unsigned long long)unsignedLongLongValue method to NSString (From: email@hidden)
 >Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString (From: Ken Thomases <email@hidden>)
 >Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString (From: email@hidden)
 >Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString (From: Ken Thomases <email@hidden>)
 >Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString (From: "Kyle Sluder" <email@hidden>)
 >Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString (From: Greg Titus <email@hidden>)
 >Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString (From: "Kyle Sluder" <email@hidden>)

  • Prev by Date: UTExportedTypeDeclarations vs CFBundleDocumentTypes
  • Next by Date: Re: Mac Pro memory sizes
  • Previous by thread: Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString
  • Next by thread: Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString
  • Index(es):
    • Date
    • Thread