title: Is it possible to use format strings to align NSStrings like numbers can be?
body: <p>I'm using <strong>NSLog()</strong> to print some tabular data consisting of an <strong>NSString</strong> and an associated <strong>integer</strong>.  </p>
  
  <p>Assume I know the length of the longest word.  </p>
  
  <p>Is there a way using <strong>format strings</strong> to get this kind of column alignment:</p>
  
  <blockquote>
  <pre><code>word:tree        rank:5  
  word:frog        rank:3  
  word:house       rank:2  
  word:peppercorn  rank:2  
  word:sword       rank:2  
  word:antlion     rank:1  
  </code></pre>
  </blockquote>
  
  <p>The reason I'm asking about formatting strings is I'm hoping for a lightweight way to format my ghetto debugging output.</p>
  
  <p><strong>Here is what I tried:</strong>  </p>
  
  <pre><code>NSString *word = @"tree";
  NSUInteger rank = 4;
  NSString *str = [NSString stringWithFormat:@"word:%-20@ rank:%u", word, rank];
  NSLog(@"%@", str);
  </code></pre>
  
  <p><strong>Result:</strong>  </p>
  
  <p><em>word:tree rank:4</em></p>
  
  <p>No effect at all.</p>