title: How can I truncate an NSString to a set length?
body: <p>I searched, but surprisingly couldn't find an answer.</p>
  
  <p>I have a long <code>NSString</code> that I want to shorten. I want the maximum length to be around 20 characters. I read somewhere that the best solution is to use <code>substringWithRange</code>. Is this the best way to truncate a string? </p>
  
  <pre><code>NSRange stringRange = {0,20};
  NSString *myString = @"This is a string, it's a very long string, it's a very long string indeed";
  NSString *shortString = [myString substringWithRange:stringRange];
  </code></pre>
  
  <p>It seems a little delicate (crashes if the string is shorter than the maximum length). I'm also not sure if it's Unicode-safe. Is there a better way to do it? Does anyone have a nice category for this?</p>