title: Comparing is one NSString greater or less then another NSString
body: <p>I'm trying to understand comparing <code>NSString</code> routine. Please consider the following code:</p>
  
  <pre><code>// String
  
      NSString *str1 = @"This is a string A";
  
      NSString *str2 = @"This is a string B";
  
      NSString *res;
  
      NSComparisonResult compareResult;
  
  compareResult = [str1 compare:str2];
  
      if (compareResult == NSOrderedAscending)
          NSLog(@"str1 &lt; str2");
  
      if (compareResult == NSOrderedSame)
          NSLog(@"str1 == str2");
      else // must be NSOrderedDescending
          NSLog(@"str1 &gt; str2");
  </code></pre>
  
  <p>My first question is, how could we determine is <code>NSString</code> greater or less then another one? Its not a number, so how exactly we determine it? </p>
  
  <p><code>NSString</code> consist of Unichar characters that are 16 bits size. Maybe compiler determine actual size of each string and compare it? </p>
  
  <p>My second question is:
  <img src="https://i.stack.imgur.com/1o4IN.png" alt="enter image description here"></p>
  
  <p>All conditions are met. How could that happen? Strings are different and we got all of 3 possible results - str1 is greater then str2, less then str2, and equal.</p>