<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: osx code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 29 Aug 2008 17:47:00 GMT</pubDate>
    <description>DZone Snippets: osx code</description>
    <item>
      <title>Objective-C and Cocoa: Human-readable file size from number of bytes</title>
      <link>http://snippets.dzone.com/posts/show/3038</link>
      <description>// Returns a human-readable string showing the file size from the number of bytes&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;- (NSString *)stringFromFileSize:(int)theSize&lt;br /&gt;{&lt;br /&gt;	float floatSize = theSize;&lt;br /&gt;	if (theSize&lt;1023)&lt;br /&gt;		return([NSString stringWithFormat:@"%i bytes",theSize]);&lt;br /&gt;	floatSize = floatSize / 1024;&lt;br /&gt;	if (floatSize&lt;1023)&lt;br /&gt;		return([NSString stringWithFormat:@"%1.1f KB",floatSize]);&lt;br /&gt;	floatSize = floatSize / 1024;&lt;br /&gt;	if (floatSize&lt;1023)&lt;br /&gt;		return([NSString stringWithFormat:@"%1.1f MB",floatSize]);&lt;br /&gt;	floatSize = floatSize / 1024;&lt;br /&gt;&lt;br /&gt;	// Add as many as you like&lt;br /&gt;&lt;br /&gt;	return([NSString stringWithFormat:@"%1.1f GB",floatSize]);&lt;br /&gt;}&lt;/code&gt;</description>
      <pubDate>Sun, 26 Nov 2006 05:51:40 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3038</guid>
      <author>maximile (Max Williams)</author>
    </item>
  </channel>
</rss>
