Remove leading and trailing spaces

March 10, 2013 in iOS Snippets

Removing start and end spaces of an NSString is very simple:


NSString* result = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];