mirror of
https://github.com/transmission/transmission
synced 2025-01-31 03:12:44 +00:00
redo [6731] using the built-in stringByTrimmingCharactersInSet:
This commit is contained in:
parent
fbea64b8ae
commit
b121a59172
4 changed files with 2 additions and 17 deletions
|
@ -311,7 +311,7 @@
|
|||
{
|
||||
NSString * tracker = (NSString *)object;
|
||||
|
||||
tracker = [tracker stringByTrimmingWhitespace];
|
||||
tracker = [tracker stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
|
||||
if ([tracker rangeOfString: @"://"].location == NSNotFound)
|
||||
tracker = [@"http://" stringByAppendingString: tracker];
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
+ (NSString *) ellipsis;
|
||||
- (NSString *) stringByAppendingEllipsis;
|
||||
|
||||
- (NSString *) stringByTrimmingWhitespace;
|
||||
|
||||
+ (NSString *) stringForFileSize: (uint64_t) size;
|
||||
|
||||
+ (NSString *) stringForSpeed: (float) speed;
|
||||
|
|
|
@ -38,19 +38,6 @@
|
|||
return [self stringByAppendingString: [NSString ellipsis]];
|
||||
}
|
||||
|
||||
- (NSString *) stringByTrimmingWhitespace
|
||||
{
|
||||
NSString * newString = self;
|
||||
while ([newString length] > 0 && [[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:
|
||||
[newString characterAtIndex: [newString length] - 1]])
|
||||
newString = [newString substringToIndex: [newString length] - 1];
|
||||
while ([newString length] > 0 && [[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:
|
||||
[newString characterAtIndex: 0]])
|
||||
newString = [newString substringFromIndex: 1];
|
||||
|
||||
return newString;
|
||||
}
|
||||
|
||||
+ (NSString *) stringForFileSize: (uint64_t) size
|
||||
{
|
||||
if (size < 1024)
|
||||
|
|
|
@ -809,7 +809,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
|
||||
NSString * tracker = [trackers objectAtIndex: i];
|
||||
|
||||
tracker = [tracker stringByTrimmingWhitespace];
|
||||
tracker = [tracker stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
|
||||
if ([tracker rangeOfString: @"://"].location == NSNotFound)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue