Re: replaceOccurrencesOfString not recognized?
Re: replaceOccurrencesOfString not recognized?
- Subject: Re: replaceOccurrencesOfString not recognized?
- From: Michael Tsai <email@hidden>
- Date: Tue, 9 Sep 2003 20:48:44 -0400
On Tuesday, September 9, 2003, at 07:53 PM, Chris Garaffa wrote:
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.
NSUserDefaults is returning an immutable NSString, which doesn't have
the replace method. So you'll need to make a -mutableCopy or something.
--Michael
_______________________________________________
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.