String trim in Objective-C/Cocoa
To trim a string and remove whitespace and newlines:
NSString *trimmedString = [dirtyString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
For other character sets, see this reference page.
Comments
by jankees on 2009-04-27 20:13:33
by jankees on 2009-04-26 09:04:13
by Aral on 2009-04-26 23:23:44
by David Chu on 2010-04-21 03:39:41
by cool8jay的Mac开发心得 » iSpeLL开发日志-2010.05.13 on 2010-05-13 16:27:40
by Robert Hook on 2010-05-15 04:33:55
by david on 2010-10-16 14:56:27
by Roger on 2012-01-29 16:37:56
by Roger on 2012-01-22 18:13:32
by Mike on 2012-01-27 16:15:55
by programming on 2012-06-22 12:43:04
by bengoat on 2012-10-03 13:55:24