• 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
NSString pedantic question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSString pedantic question


  • Subject: NSString pedantic question
  • From: John Stiles <email@hidden>
  • Date: Wed, 28 Mar 2007 16:53:12 -0700

I am writing code that deals with NSStrings and paths.

I know that, to turn an NSString into a proper path, the best API to use is [myString fileSystemRepresentation]. You can also use [myString UTF8String] and it seems to work fine, but everyone says that the best, future-proof method is -fileSystemRepresentation, so we use it without question.

But what about going in reverse—if you've got a file system representation in a char array, there doesn't seem to be a [NSString stringWithFileSystemRepresentation:myCharPtr] API to load it back into an NSString. I've been using [NSString stringWithUTF8String:myCharPtr], which works fine, but it doesn't feel all nice and symmetric like it should. If that hypothetical future came to pass where the file system representation was no longer UTF8, I'd have to revamp this code. I don't expect that this will ever be an issue in practice, but I still feel like I'm missing something.

Any thoughts?_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: NSString pedantic question
      • From: Aki Inoue <email@hidden>
    • Re: NSString pedantic question
      • From: Ryan Britton <email@hidden>
  • Prev by Date: [Q] Cocoa-Java bridge
  • Next by Date: Re: NSString pedantic question
  • Previous by thread: Fwd: [Q] Cocoa-Java bridge
  • Next by thread: Re: NSString pedantic question
  • Index(es):
    • Date
    • Thread