replaceOccurrencesOfString not recognized?
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.