Remove white space/new line from the of NSString

 = [yourString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];

it will remove all extra space from left as well as right but not from middle

and to remove both white space and \n use

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

http://stackoverflow.com/questions/6278593/remove-white-space-from-the-left-of-nsstring