One Quickie


Trimming whitespace from ends of a string (NSString->General)
    NSString *ook = @"\n \t\t hello there \t\n  \n\n";
    NSString *trimmed =
        [ook stringByTrimmingCharactersInSet:
                 [NSCharacterSet whitespaceAndNewlineCharacterSet]];

    NSLog(@"trimmed: '%@'", trimmed);
produces
2009-12-24 18:24:42.431 trim[6799:903] trimmed: 'hello there'



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com