Declared in NSString+DTFormatNumbers.h

Overview

A collection of category extensions for NSString dealing with the formatting of numbers in special contexts.

Tasks

Formatting File Sizes

Class Methods

stringByFormattingBytes:

Formats the passed number as a byte value in a form that is pleasing to the user when displayed next to a progress bar.

+ (NSString *)stringByFormattingBytes:(long long)bytes

Parameters

bytes

The value of the bytes to be formatted

Return Value

Returns the formatted string.

Discussion

Output numbers are rounded to one decimal place. Bytes are not abbreviated because most users might not be used to B for that. Higher units are kB, MB, GB and TB.

Declared In

NSString+DTFormatNumbers.h