From: Jay Freeman (saurik) Date: Wed, 10 Sep 2008 02:06:39 +0000 (+0000) Subject: Adding file from backup iphone. X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/7fb3cc0fc3898a1f1c562924fe8a8f75b5a75132 Adding file from backup iphone. --- diff --git a/UICaboodle/UCString.h b/UICaboodle/UCString.h new file mode 100644 index 00000000..77ee6a1b --- /dev/null +++ b/UICaboodle/UCString.h @@ -0,0 +1,26 @@ +#ifndef UICABOODLE_UCSTRING_H +#define UICABOODLE_UCSTRING_H + +#import + +@interface NSString (UICaboodle) ++ (NSString *) stringWithDataSize:(double)size; +@end + +@implementation NSString (UICaboodle) + ++ (NSString *) stringWithDataSize:(double)size { + unsigned power = 0; + while (size > 1024) { + size /= 1024; + ++power; + } + + static const char *powers_[] = {"B", "KiB", "MiB", "GiB"}; + + return [NSString stringWithFormat:@"%.1f%s", size, powers_[power]]; +} + +@end + +#endif/*UICABOODLE_UCSTRING_H*/