<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Codec &#187; if</title>
	<atom:link href="http://www.trembl.org/codec/tag/if/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.trembl.org/codec</link>
	<description>A Personal Polylogic Code/Decode &#039;Zettelkasten&#039;</description>
	<lastBuildDate>Thu, 02 Feb 2012 03:38:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Zero-Padding in Objective-C</title>
		<link>http://www.trembl.org/codec/381/</link>
		<comments>http://www.trembl.org/codec/381/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 09:17:05 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[if]]></category>
		<category><![CDATA[NSString]]></category>
		<category><![CDATA[padding]]></category>
		<category><![CDATA[substring]]></category>
		<category><![CDATA[zero]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/?p=381</guid>
		<description><![CDATA[The age-old problem. Files, that are stored with padded zeros 000, 001, 002, 003 &#8211; and a counter that doesn&#8217;t have this zero-padding. There are probably myriad solution to that problem, here&#8217;s my take: Create a temporary string consisting of a minimum of 3 characters length. NSString *tempZeros = &#91;NSString stringWithFormat:@&#34;00%i&#34;, i&#93;; Get the last [...]]]></description>
			<content:encoded><![CDATA[<p>The age-old problem. Files, that are stored with padded zeros 000, 001, 002, 003 &#8211; and a counter that doesn&#8217;t have this zero-padding. There are probably myriad solution to that problem, here&#8217;s my take:</p>
<p><em>Create a temporary string consisting of a minimum of 3 characters length.</em></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>tempZeros <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;00%i&quot;</span>, i<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p><em>Get the last 3 characters, shave off the rest.</em></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>zeroPaddedIndex <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>tempZeros substringFromIndex<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>tempZeros length<span style="color: #002200;">&#93;</span> <span style="color: #002200;">-</span> <span style="color: #2400d9;">3</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>No if&#8217;s, no but&#8217;s, no clauses.</p>
<p>Update: Of course, there&#8217;s always a better way. <a href="http://www.trembl.org/codec/452/">452</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/381/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

