Changeset 6732


Ignore:
Timestamp:
Sep 6, 2008, 1:49:20 PM (13 years ago)
Author:
livings124
Message:

redo [6731] using the built-in stringByTrimmingCharactersInSet:

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/CreatorWindowController.m

    r6731 r6732  
    312312    NSString * tracker = (NSString *)object;
    313313   
    314     tracker = [tracker stringByTrimmingWhitespace];
     314    tracker = [tracker stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
    315315   
    316316    if ([tracker rangeOfString: @"://"].location == NSNotFound)
  • trunk/macosx/NSStringAdditions.h

    r6731 r6732  
    3030- (NSString *) stringByAppendingEllipsis;
    3131
    32 - (NSString *) stringByTrimmingWhitespace;
    33 
    3432+ (NSString *) stringForFileSize: (uint64_t) size;
    3533
  • trunk/macosx/NSStringAdditions.m

    r6731 r6732  
    3737{
    3838        return [self stringByAppendingString: [NSString ellipsis]];
    39 }
    40 
    41 - (NSString *) stringByTrimmingWhitespace
    42 {
    43     NSString * newString = self;
    44     while ([newString length] > 0 && [[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:
    45                                         [newString characterAtIndex: [newString length] - 1]])
    46         newString = [newString substringToIndex: [newString length] - 1];
    47     while ([newString length] > 0 && [[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:
    48                                         [newString characterAtIndex: 0]])
    49         newString = [newString substringFromIndex: 1];
    50    
    51     return newString;
    5239}
    5340
  • trunk/macosx/Torrent.m

    r6731 r6732  
    810810    NSString * tracker = [trackers objectAtIndex: i];
    811811   
    812     tracker = [tracker stringByTrimmingWhitespace];
     812    tracker = [tracker stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
    813813   
    814814    if ([tracker rangeOfString: @"://"].location == NSNotFound)
Note: See TracChangeset for help on using the changeset viewer.