Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

macindev

macrumors newbie
Original poster
I have no clue how to do this!
What I want to be done is to have the spaces in a string be changed to plus "+" signs, but I don't know what code would be needed. Can anyone help?
Thanks in advance.


For those who want to know, here's my code:

Code:
- (void)connectSearch:(id)sender{
	[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:
	[@"http://www.google.com/search?q=" stringByAppendingString:[searchQuery stringValue]]]]];
}
 
I have no clue how to do this!
What I want to be done is to have the spaces in a string be changed to plus "+" signs, but I don't know what code would be needed. Can anyone help?
Thanks in advance.


For those who want to know, here's my code:

Code:
- (void)connectSearch:(id)sender{
	[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:
	[@"http://www.google.com/search?q=" stringByAppendingString:[searchQuery stringValue]]]]];
}


In XCode, right-click on the word "stringByAppendingString", select "Show in API Reference" in the popup menu, and read the documentation of the NSString functions.
 
Thank You! I finally got it to work using this
Code:
stringByReplacingOccurrencesOfString:(NSString *)replaceString withString:(NSString *)replaceStringWith
😀
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.