title: Checking the length of an array of characters in Objective-C
body: <p>I'm translating a small Java library for using in an Objective-C application I'm writing.</p>
  <pre><code>char[] chars = sentence.toCharArray();
  int i = 0;
  while (i &lt; chars.length) { ... }
  </code></pre>
  <p>Where sentence is an NSString.
  I'd like to translate the above Java code to Objective-C. Here's what I have so far:</p>
  <pre><code>// trims sentence off white space
  sentence = [sentence stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
  const char *chars = [sentence UTF8String];
  </code></pre>
  <p>How do I the above while condition? I'm not sure of how I'm supposed to check the length of the the string after it was converted to a character array.</p>