• 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: Correct usage of replaceOccurencesOfString:withString:options:range
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Correct usage of replaceOccurencesOfString:withString:options:range


  • Subject: Re: Correct usage of replaceOccurencesOfString:withString:options:range
  • From: Kevin Ballard <email@hidden>
  • Date: Sat, 26 Feb 2005 11:10:08 -0500

Yes, but you're missing what he's saying. He's saying that you don't need to replace spaces with backslash-space at all, since the arguments don't undergo shell expansion (and, in turn, word splitting).

On Feb 26, 2005, at 8:55 AM, Darkshadow wrote:

On Feb 25, 2005, at 5:15 PM, Justin Spahr-Summers wrote:

The NSTask docs say that the arguments do not undergo shell expansion,
thus you do not need to escape spaces.

On Fri, 25 Feb 2005 6:12:34 +0000, email@hidden
<email@hidden> wrote:
Could someone please illustrate the correct usage of this method from NSMutableString? I have a string that represents a path to a file on the filesystem. If there are any spaces in the path (such as a folder name), I need to escape those spaces with a "\" so I can use them as an argument to an NSTask running a command-line tool.



The problem wasn't with the string being sent to the task, it was with -replaceOccurrencesOfString:withString:options:range. It was a compile time error, not runtime error. You do need to escape it in that case.

-- Kevin Ballard email@hidden http://www.tildesoft.com http://kevin.sb.org

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Correct usage of replaceOccurencesOfString:withString:options:range (From: <email@hidden>)
 >Re: Correct usage of replaceOccurencesOfString:withString:options:range (From: Justin Spahr-Summers <email@hidden>)
 >Re: Correct usage of replaceOccurencesOfString:withString:options:range (From: Darkshadow <email@hidden>)

  • Prev by Date: Re: Correct usage of replaceOccurencesOfString:withString:options:range
  • Next by Date: Re: Making NSView respond to command+key equivalent
  • Previous by thread: Re: Correct usage of replaceOccurencesOfString:withString:options:range
  • Next by thread: NSString's compare: doesn't work...
  • Index(es):
    • Date
    • Thread