```obj-c
- (NSString *)trim {
    NSCharacterSet *set = [NSCharacterSet whitespaceCharacterSet];
    return [self stringByTrimmingCharactersInSet:set];
}
```

Looks like using `whitespaceAndNewlineCharacterSet` there would do the trick