Re: lots of find/replace in text file

2011-01-25 Thread Matt Neuburg
On Jan 24, 2011, at 6:54 PM, Kyle Sluder wrote: On Jan 24, 2011, at 6:02 PM, Matt Neuburg m...@tidbits.com wrote: (2) A common trick is make the text file a format string (i.e., containing a lot of %@) and just hand it to stringWithFormat along with all the substitutions. Badda bing

Re: lots of find/replace in text file

2011-01-25 Thread Kyle Sluder
On Tue, Jan 25, 2011 at 1:56 AM, Matt Neuburg m...@tidbits.com wrote: This is madlibs; the template string comes from him, the programmer. Only the words that go into the blanks come from the user. You'll need to prove to me that performing the substitution this way is any more dangerous than

Re: lots of find/replace in text file

2011-01-25 Thread Matt Neuburg
On Tue, 25 Jan 2011 02:17:46 -0800, Kyle Sluder kyle.slu...@gmail.com said: For something more complicated, a simple XML format might be appropriate: madlib The quick blank type=adjective / fox jumped over the lazy blank type=noun / /madlib Especially if you want to share the resulting madlib

Re: lots of find/replace in text file

2011-01-24 Thread Matt Neuburg
On Jan 22, 2011, at 9:37 AM, cocoa-dev-requ...@lists.apple.com wrote: Date: Sat, 22 Jan 2011 09:19:50 -0500 From: Jeremy Matthews jeremymatth...@mac.com Subject: lots of find/replace in text file So...the app I previously mentioned, ala Mad Libs...I now have lots more text to replace

lots of find/replace in text file

2011-01-22 Thread Jeremy Matthews
So...the app I previously mentioned, ala Mad Libs...I now have lots more text to replace within the file (new additions). Besides using find/replace using NSScanner and NSStrings' stringByReplacingOccurrencesOfStringis there a better way, to perform a slew of find/place operations with a

Re: lots of find/replace in text file

2011-01-22 Thread Greg Guerin
Jeremy Matthews wrote: I can't help but think there might be a better (and more efficient way) of handling this? How much better (and more efficient) does it have to be? It's a simple game, right? Is it currently too slow or memory- consuming? If not, why change it? If you want a

Re: lots of find/replace in text file

2011-01-22 Thread Gary L. Wade
The Mad Libs program I was working on just used the standard printf placeholders with the ordering parameters. When showing the parts of speech, I just supply adjective. When showing the user's choice, I just supply red. - Gary L. Wade (Sent from my iPhone) On Jan 22, 2011, at 6:19 AM, Jeremy