Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Tom Coomer
1,331 PointsRemove double spaces in string xcode
How would I remove double spaces in a string in xcode?
E.g Treehouse is great to Treehouse is great
1 Answer
Alex Hedley
16,381 PointsNSString *str = @"This is a string";
str = [str stringByReplacingOccurrencesOfString:@"string" withString:@"duck"];
Tom Coomer
1,331 PointsTom Coomer
1,331 PointsWhere do I put this?
Alex Hedley
16,381 PointsAlex Hedley
16,381 PointsWhere are you getting the string you want to amend?
Are you storing this in a variable?
Tom Coomer
1,331 PointsTom Coomer
1,331 PointsI am trying to detect it in a label when clicking a button
Tom Coomer
1,331 PointsTom Coomer
1,331 PointsAll I have done is
-(IBAction)button{ Label.text=@"Hello world" }