Guest User

Untitled

a guest
Sep 14th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. How to identify and remove newline and white spaces?
  2. for (int i=0;i<contentsOfFile.count; i++)
  3. {
  4. if(!([[contentsOfFile objectAtIndex:i]isEqual:@"n"]||[[contentsOfFile objectAtIndex:i]isEqual:@""]))
  5. [arrayToBereturned addObject:[contentsOfFile objectAtIndex:i]];
  6. }
  7.  
  8. NSString *string = @"Hello, World!";
  9. NSCharacterSet *separator = [NSCharacterSet whitespaceAndNewlineCharacterSet];
  10. NSArray *stringComponents = [string componentsSeparatedByCharactersInSet:separator];
  11.  
  12. NSString* result = [yourString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
Add Comment
Please, Sign In to add comment