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 trialTommy Choe
38,156 PointsNeed help understanding syntax for NSString method call 'stringByTrimmingCharactersInSet'
Why is the proper syntax for this method call [self.usernameField.text stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewLineCharacterSet]]; instead of something like [NSCharacterSet stringByTrimmingCharactersInSet: self.usernameField.text?
I'm not understanding how this works.
P.S. I tried reading the document but I still don't understand why this method call is structured like this.
Tommy Choe
38,156 PointsThanks Michael!
1 Answer
landonferrier
25,097 PointsTommy, here is a full template for the social network application: Click Here.
Michael Metzger
11,983 PointsMichael Metzger
11,983 PointsBoth of these syntax achieve the same thing. In method two, you are simply creating the NSCharaterSet instance in the same line. Hope this helps!