Re: Escaping white space in an NSString
Re: Escaping white space in an NSString
- Subject: Re: Escaping white space in an NSString
- From: Seth Willits <email@hidden>
- Date: Wed, 20 May 2009 22:30:54 -0700
On May 20, 2009, at 10:23 PM, Bruce Johnson wrote:
I have a unix path in an NSString via [[NSBundle bundleForClass: [self
class]] pathForResource: etc.. etc..
The problem is that the path has white spaces scattered in the string.
And I need to pass the unix path to a CLI application. The CLI app
croaks on the white spaces (for obvious reasons)
Is there a standard Cocoa way of escaping the white spaces like is
done in the Terminal Application (I'm not looking for percent escapes)
that has eluded my searches today?
I also would like it to work in both Leopard and iPhone.
Well, if you're firing off the command line app from within your Cocoa
app, typically you'd be using NSTask and simply pass the string as an
argument without having to escape it. There's no built-in way to
escape strings for a shell because Cocoa doesn't interact with any
shell instances and what has to be escaped depends on the destination.
--
Seth Willits
_______________________________________________
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