Changeset 1302 for trunk/macosx/StringAdditions.m
- Timestamp:
- Dec 30, 2006, 7:24:09 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/StringAdditions.m
r1081 r1302 24 24 25 25 #import "StringAdditions.h" 26 #import <transmission.h> 26 27 27 28 @implementation NSString (StringAdditions) … … 94 95 } 95 96 96 + (NSString *) stringForRatio WithDownload: (uint64_t) down upload: (uint64_t) up97 + (NSString *) stringForRatio: (float) ratio 97 98 { 98 if ( down == 0)99 return up == 0 ? NSLocalizedString(@"N/A", "No Ratio") : [NSString stringWithUTF8String: "\xE2\x88\x9E"];100 101 float ratio = (float) up / (float) down;102 if (ratio < 10.0)99 if (ratio == TR_RATIO_NA) 100 return NSLocalizedString(@"N/A", "No Ratio"); 101 else if (ratio == TR_RATIO_INF) 102 return [NSString stringWithUTF8String: "\xE2\x88\x9E"]; 103 else if (ratio < 10.0) 103 104 return [NSString stringWithFormat: @"%.2f", ratio]; 104 105 else if (ratio < 100.0)
Note: See TracChangeset
for help on using the changeset viewer.