Posted By

vaishnavi on 01/24/12


Tagged

whitespace nsstring


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Tintenklecks
cnathan


Removing whitespace from NSString


 / Published in: Objective C
 

URL: http://www.cocoanetics.com/2009/01/remove-whitespace-from-nsstring/

removing whitespace from front and end of a string

  1. NSString *string = @" spaces in front and at the end ";
  2. NSString *trimmedString = [string stringByTrimmingCharactersInSet:
  3. [NSCharacterSet whitespaceAndNewlineCharacterSet]];
  4. NSLog(trimmedString)

Report this snippet  

You need to login to post a comment.