• 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
replaceOccurrencesOfString not recognized?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

replaceOccurrencesOfString not recognized?


  • Subject: replaceOccurrencesOfString not recognized?
  • From: Chris Garaffa <email@hidden>
  • Date: Tue, 9 Sep 2003 19:53:11 -0400

Hi everyone,

I'm trying to replace a piece of an NSMutableString with another string. The following code:

NSString *selectedItem = [[popupMenu selectedItem] title];
NSMutableString *siteSearchSyntax = [[NSUserDefaults standardUserDefaults] objectForKey:selectedItem];
NSRange whereFound = [siteSearchSyntax rangeOfString: @"<$sbSearchTerm$>"];
[siteSearchSyntax replaceOccurrencesOfString: @"<$sbSearchTerm$>" withString: [searchText stringValue] options: NSLiteralSearch range: whereFound];
Seems to work, with the exception of the last line. When I run the code, I find that selectedItem is valid (by placing an NSLog after the first line) and that siteSearchSyntax is valid (by placing an NSLog after the second line), and that [searchText stringValue] is valid, but on the fourth line, I get the error in my log that the selector is not recognized.

The situation is that siteSearchSyntax contains <$sbSearchTerm$> which I'd like to replace with the value of a text field, searchText.

Any ideas?

Thanks,

Chris Garaffa
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • RE: replaceOccurrencesOfString not recognized?
      • From: "Jonathan E. Jackel" <email@hidden>
    • Re: replaceOccurrencesOfString not recognized?
      • From: Nick Zitzmann <email@hidden>
    • Re: replaceOccurrencesOfString not recognized?
      • From: Michael Tsai <email@hidden>
    • NSOpenPanel and the New Folder button
      • From: John Stiles <email@hidden>
  • Prev by Date: Re: anything for cocoa other than java or obj-c?
  • Next by Date: NSOpenPanel and the New Folder button
  • Previous by thread: Identifying what symbol you're in
  • Next by thread: NSOpenPanel and the New Folder button
  • Index(es):
    • Date
    • Thread