This is how to trim a string and remove whitespace and newlines:
NSString *trimmedString = [dirtyString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
For other character sets, refer to
http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSCharacterSet_Class/Reference/Reference.html#//apple_ref/doc/uid/20000157-SW5.
Tuesday, August 31, 2010
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment